diff --git a/src/authentic2_auth_fc/templates/authentic2_auth_fc/manager_user_sidebar.html b/src/authentic2_auth_fc/templates/authentic2_auth_fc/manager_user_sidebar.html index 98665d367..dcd8f0ff8 100644 --- a/src/authentic2_auth_fc/templates/authentic2_auth_fc/manager_user_sidebar.html +++ b/src/authentic2_auth_fc/templates/authentic2_auth_fc/manager_user_sidebar.html @@ -1,6 +1,6 @@ {% load i18n %} {% for account in user.fc_accounts.all %}
{% endfor %} diff --git a/src/authentic2_auth_oidc/apps.py b/src/authentic2_auth_oidc/apps.py index b6792ef41..340531215 100644 --- a/src/authentic2_auth_oidc/apps.py +++ b/src/authentic2_auth_oidc/apps.py @@ -15,6 +15,7 @@ # along with this program. If not, see+{% blocktrans trimmed with created=user.oidc_account.created name=user.oidc_account.provider.name sub=user.oidc_account.sub %} +Link with OIDC provider {{ name }} created on {{ created }} (sub {{ sub }}). +{% endblocktrans %} +
+{% endif %} diff --git a/src/authentic2_auth_saml/apps.py b/src/authentic2_auth_saml/apps.py index 941c5be67..b02cc6ae5 100644 --- a/src/authentic2_auth_saml/apps.py +++ b/src/authentic2_auth_saml/apps.py @@ -15,6 +15,8 @@ # along with this program. If not, see+{% blocktrans trimmed with created=identifier.created name_id=identifier.name_id %} +Link with SAML provider {{ provider }} created on {{ created }} (NameID {{ name_id }}). +{% endblocktrans %} +
+{% endfor %} diff --git a/tests/test_auth_oidc.py b/tests/test_auth_oidc.py index 9990671ef..e046a886b 100644 --- a/tests/test_auth_oidc.py +++ b/tests/test_auth_oidc.py @@ -899,3 +899,16 @@ def test_multiple_users_with_same_email(app, caplog, code, oidc_provider_jwkset, assert '_auth_user_id' not in app.session assert OIDCAccount.objects.count() == 0 assert 'too many users' in caplog.records[-1].message + + +def test_manager_user_sidebar(app, superuser, simple_user, oidc_provider): + utils.login(app, superuser, '/manage/') + response = app.get('/manage/users/%s/' % simple_user.id) + assert 'OIDC' not in response + + OIDCAccount.objects.create(user=simple_user, provider=oidc_provider, sub='1234') + + response = app.get('/manage/users/%s/' % simple_user.id) + assert 'OIDC' in response + assert 'Server' in response + assert '1234' in response diff --git a/tests/test_auth_saml.py b/tests/test_auth_saml.py index 5d4bf49d2..abdeee1f2 100644 --- a/tests/test_auth_saml.py +++ b/tests/test_auth_saml.py @@ -26,6 +26,8 @@ from authentic2.custom_user.models import DeletedUser from authentic2.models import Attribute from authentic2_auth_saml.adapters import AuthenticAdapter, MappingError +from .utils import login + User = get_user_model() @@ -273,3 +275,16 @@ def test_save_account_on_delete_user(db): 'name_id': '4567', }, ] + + +def test_manager_user_sidebar(app, superuser, simple_user): + login(app, superuser, '/manage/') + response = app.get('/manage/users/%s/' % simple_user.id) + assert 'SAML' not in response + + UserSAMLIdentifier.objects.create(user=simple_user, issuer='https://idp1.com/', name_id='1234') + + response = app.get('/manage/users/%s/' % simple_user.id) + assert 'SAML' in response + assert 'https://idp1.com/' in response + assert '1234' in response