mirror of
https://github.com/ansible/awx.git
synced 2026-04-25 19:55:24 -02:30
Remove OIDC (#15569)
* remove oidc * remove test fields, linting fix * merge commit
This commit is contained in:
20
awx/conf/migrations/0011_remove_oidc_auth_conf.py
Normal file
20
awx/conf/migrations/0011_remove_oidc_auth_conf.py
Normal file
@@ -0,0 +1,20 @@
|
||||
# Generated by Django 4.2.10 on 2024-08-27 19:31
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
OIDC_AUTH_CONF_KEYS = ['SOCIAL_AUTH_OIDC_KEY', 'SOCIAL_AUTH_OIDC_SECRET', 'SOCIAL_AUTH_OIDC_OIDC_ENDPOINT', 'SOCIAL_AUTH_OIDC_VERIFY_SSL']
|
||||
|
||||
|
||||
def remove_oidc_auth_conf(apps, scheme_editor):
|
||||
setting = apps.get_model('conf', 'Setting')
|
||||
setting.objects.filter(key__in=OIDC_AUTH_CONF_KEYS).delete()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
('conf', '0010_change_to_JSONField'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(remove_oidc_auth_conf),
|
||||
]
|
||||
@@ -143,54 +143,6 @@ if settings.ALLOW_LOCAL_RESOURCE_MANAGEMENT:
|
||||
category_slug='authentication',
|
||||
)
|
||||
|
||||
###############################################################################
|
||||
# Generic OIDC AUTHENTICATION SETTINGS
|
||||
###############################################################################
|
||||
|
||||
register(
|
||||
'SOCIAL_AUTH_OIDC_KEY',
|
||||
field_class=fields.CharField,
|
||||
allow_null=False,
|
||||
default=None,
|
||||
label=_('OIDC Key'),
|
||||
help_text='The OIDC key (Client ID) from your IDP.',
|
||||
category=_('Generic OIDC'),
|
||||
category_slug='oidc',
|
||||
)
|
||||
|
||||
register(
|
||||
'SOCIAL_AUTH_OIDC_SECRET',
|
||||
field_class=fields.CharField,
|
||||
allow_blank=True,
|
||||
default='',
|
||||
label=_('OIDC Secret'),
|
||||
help_text=_('The OIDC secret (Client Secret) from your IDP.'),
|
||||
category=_('Generic OIDC'),
|
||||
category_slug='oidc',
|
||||
encrypted=True,
|
||||
)
|
||||
|
||||
register(
|
||||
'SOCIAL_AUTH_OIDC_OIDC_ENDPOINT',
|
||||
field_class=fields.CharField,
|
||||
allow_blank=True,
|
||||
default='',
|
||||
label=_('OIDC Provider URL'),
|
||||
help_text=_('The URL for your OIDC provider including the path up to /.well-known/openid-configuration'),
|
||||
category=_('Generic OIDC'),
|
||||
category_slug='oidc',
|
||||
)
|
||||
|
||||
register(
|
||||
'SOCIAL_AUTH_OIDC_VERIFY_SSL',
|
||||
field_class=fields.BooleanField,
|
||||
default=True,
|
||||
label=_('Verify OIDC Provider Certificate'),
|
||||
help_text=_('Verify the OIDC provider ssl certificate.'),
|
||||
category=_('Generic OIDC'),
|
||||
category_slug='oidc',
|
||||
)
|
||||
|
||||
###############################################################################
|
||||
# SAML AUTHENTICATION SETTINGS
|
||||
###############################################################################
|
||||
|
||||
@@ -303,24 +303,14 @@ class TestCommonFunctions:
|
||||
(True, False, 'social'),
|
||||
],
|
||||
)
|
||||
def test_get_external_account(self, enable_social, enable_enterprise, expected_results):
|
||||
|
||||
def test_get_external_account(self, enable_enterprise, expected_results):
|
||||
try:
|
||||
user = User.objects.get(username="external_tester")
|
||||
except User.DoesNotExist:
|
||||
user = User(username="external_tester")
|
||||
user.set_unusable_password()
|
||||
user.save()
|
||||
|
||||
if enable_social:
|
||||
from social_django.models import UserSocialAuth
|
||||
|
||||
social_auth, _ = UserSocialAuth.objects.get_or_create(
|
||||
uid='667ec049-cdf3-45d0-a4dc-0465f7505954',
|
||||
provider='oidc',
|
||||
extra_data={},
|
||||
user_id=user.id,
|
||||
)
|
||||
user.social_auth.set([social_auth])
|
||||
if enable_enterprise:
|
||||
from awx.sso.models import UserEnterpriseAuth
|
||||
|
||||
@@ -335,8 +325,6 @@ class TestCommonFunctions:
|
||||
# Set none of the social auth settings
|
||||
('JUNK_SETTING', False),
|
||||
('SOCIAL_AUTH_SAML_ENABLED_IDPS', True),
|
||||
# Set some SOCIAL_SOCIAL_AUTH_OIDC_KEYAUTH_*_KEY settings
|
||||
('SOCIAL_AUTH_OIDC_KEY', True),
|
||||
# Try a hypothetical future one
|
||||
('SOCIAL_AUTH_GIBBERISH_KEY', True),
|
||||
# Do a SAML one
|
||||
|
||||
Reference in New Issue
Block a user