From 594e2d13e9e714f4dd70f607135353ac530848c4 Mon Sep 17 00:00:00 2001 From: Valentin Deniaud Date: Mon, 22 Aug 2022 11:27:40 +0200 Subject: [PATCH 1/2] auth_saml: clarify some parameters (#67875) --- .../migrations/0001_initial.py | 8 +++----- src/authentic2_auth_saml/models.py | 19 ++++--------------- tests/test_manager_authenticators.py | 1 - 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/src/authentic2_auth_saml/migrations/0001_initial.py b/src/authentic2_auth_saml/migrations/0001_initial.py index 0e84d4515..5186c1209 100644 --- a/src/authentic2_auth_saml/migrations/0001_initial.py +++ b/src/authentic2_auth_saml/migrations/0001_initial.py @@ -50,9 +50,7 @@ class Migration(migrations.Migration): ( 'provision', models.BooleanField( - default=True, - help_text='Create user if their username does not already exists.', - verbose_name='Provision', + default=True, verbose_name='Create user if their username does not already exists' ), ), ( @@ -81,9 +79,9 @@ class Migration(migrations.Migration): 'realm', models.CharField( default='saml', - help_text='The default realm to associate to user, used when setting username.', + help_text='The default realm to associate to user, can be used in username template.', max_length=32, - verbose_name='Realm', + verbose_name='Realm (realm)', ), ), ( diff --git a/src/authentic2_auth_saml/models.py b/src/authentic2_auth_saml/models.py index 81a81e7a1..1c581ef37 100644 --- a/src/authentic2_auth_saml/models.py +++ b/src/authentic2_auth_saml/models.py @@ -38,11 +38,7 @@ class SAMLAuthenticator(BaseAuthenticator): ) metadata = models.TextField(_('Metadata (XML)'), blank=True) - provision = models.BooleanField( - _('Provision'), - default=True, - help_text=_('Create user if their username does not already exists.'), - ) + provision = models.BooleanField(_('Create user if their username does not already exists'), default=True) verify_ssl_certificate = models.BooleanField( _('Verify SSL certificate'), default=True, @@ -57,9 +53,9 @@ class SAMLAuthenticator(BaseAuthenticator): blank=True, ) realm = models.CharField( - _('Realm'), + _('Realm (realm)'), max_length=32, - help_text=_('The default realm to associate to user, used when setting username.'), + help_text=_('The default realm to associate to user, can be used in username template.'), default='saml', ) username_template = models.CharField( @@ -144,14 +140,7 @@ class SAMLAuthenticator(BaseAuthenticator): type = 'saml' how = ['saml'] manager_view_template_name = 'authentic2_auth_saml/authenticator_detail.html' - description_fields = [ - 'show_condition', - 'metadata_url', - 'metadata_path', - 'metadata', - 'provision', - 'username_template', - ] + description_fields = ['show_condition', 'metadata_url', 'metadata_path', 'metadata', 'provision'] class Meta: verbose_name = _('SAML') diff --git a/tests/test_manager_authenticators.py b/tests/test_manager_authenticators.py index c68dbbb42..8c4d530bc 100644 --- a/tests/test_manager_authenticators.py +++ b/tests/test_manager_authenticators.py @@ -284,7 +284,6 @@ def test_authenticators_saml(app, superuser, ou1, ou2): authenticator = SAMLAuthenticator.objects.filter(slug='test').get() resp = app.get(authenticator.get_absolute_url()) - assert 'Username template: {attributes[name_id_content]}@{realm}' in resp.text assert 'Provision: True' in resp.text assert 'Metadata file path' not in resp.text -- 2.30.2