mirror of
https://github.com/ansible/awx.git
synced 2026-04-28 05:05:25 -02:30
Remove SAML authentication (#15568)
* remove saml * remove license file and management command * update requirements, add migrations * remove unused imports
This commit is contained in:
40
awx/conf/migrations/0011_remove_saml_auth_conf.py
Normal file
40
awx/conf/migrations/0011_remove_saml_auth_conf.py
Normal file
@@ -0,0 +1,40 @@
|
||||
# Generated by Django 4.2.10 on 2024-08-27 14:20
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
SAML_AUTH_CONF_KEYS = [
|
||||
'SAML_AUTO_CREATE_OBJECTS',
|
||||
'SOCIAL_AUTH_SAML_CALLBACK_URL',
|
||||
'SOCIAL_AUTH_SAML_METADATA_URL',
|
||||
'SOCIAL_AUTH_SAML_SP_ENTITY_ID',
|
||||
'SOCIAL_AUTH_SAML_SP_PUBLIC_CERT',
|
||||
'SOCIAL_AUTH_SAML_SP_PRIVATE_KEY',
|
||||
'SOCIAL_AUTH_SAML_ORG_INFO',
|
||||
'SOCIAL_AUTH_SAML_TECHNICAL_CONTACT',
|
||||
'SOCIAL_AUTH_SAML_SUPPORT_CONTACT',
|
||||
'SOCIAL_AUTH_SAML_ENABLED_IDPS',
|
||||
'SOCIAL_AUTH_SAML_SECURITY_CONFIG',
|
||||
'SOCIAL_AUTH_SAML_SP_EXTRA',
|
||||
'SOCIAL_AUTH_SAML_EXTRA_DATA',
|
||||
'SOCIAL_AUTH_SAML_ORGANIZATION_MAP',
|
||||
'SOCIAL_AUTH_SAML_TEAM_MAP',
|
||||
'SOCIAL_AUTH_SAML_ORGANIZATION_ATTR',
|
||||
'SOCIAL_AUTH_SAML_TEAM_ATTR',
|
||||
'SOCIAL_AUTH_SAML_USER_FLAGS_BY_ATTR',
|
||||
]
|
||||
|
||||
|
||||
def remove_saml_auth_conf(apps, scheme_editor):
|
||||
setting = apps.get_model('conf', 'Setting')
|
||||
setting.objects.filter(key__in=SAML_AUTH_CONF_KEYS).delete()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('conf', '0010_change_to_JSONField'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(remove_saml_auth_conf),
|
||||
]
|
||||
@@ -8,7 +8,6 @@ from awx.main.utils.encryption import decrypt_field
|
||||
from awx.conf import fields
|
||||
from awx.conf.registry import settings_registry
|
||||
from awx.conf.models import Setting
|
||||
from awx.sso import fields as sso_fields
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -103,24 +102,6 @@ def test_setting_singleton_update(api_request, dummy_setting):
|
||||
assert response.data['FOO_BAR'] == 4
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_setting_singleton_update_hybriddictfield_with_forbidden(api_request, dummy_setting):
|
||||
# Some HybridDictField subclasses have a child of _Forbidden,
|
||||
# indicating that only the defined fields can be filled in. Make
|
||||
# sure that the _Forbidden validator doesn't get used for the
|
||||
# fields. See also https://github.com/ansible/awx/issues/4099.
|
||||
with dummy_setting('FOO_BAR', field_class=sso_fields.SAMLOrgAttrField, category='FooBar', category_slug='foobar'), mock.patch(
|
||||
'awx.conf.views.clear_setting_cache'
|
||||
):
|
||||
api_request(
|
||||
'patch',
|
||||
reverse('api:setting_singleton_detail', kwargs={'category_slug': 'foobar'}),
|
||||
data={'FOO_BAR': {'saml_admin_attr': 'Admins', 'saml_attr': 'Orgs'}},
|
||||
)
|
||||
response = api_request('get', reverse('api:setting_singleton_detail', kwargs={'category_slug': 'foobar'}))
|
||||
assert response.data['FOO_BAR'] == {'saml_admin_attr': 'Admins', 'saml_attr': 'Orgs'}
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_setting_singleton_update_dont_change_readonly_fields(api_request, dummy_setting):
|
||||
with dummy_setting('FOO_BAR', field_class=fields.IntegerField, read_only=True, default=4, category='FooBar', category_slug='foobar'), mock.patch(
|
||||
|
||||
Reference in New Issue
Block a user