From 1d2725825c2c950831dbd100ab17bbf1f838a730 Mon Sep 17 00:00:00 2001 From: Jens L Date: Tue, 28 Mar 2023 14:42:52 +0200 Subject: [PATCH] providers/scim: add missing default fields (#5108) * providers/scim: add missing default fields Signed-off-by: Jens Langhammer #4554 * update tests Signed-off-by: Jens Langhammer --------- Signed-off-by: Jens Langhammer --- authentik/providers/scim/tests/test_membership.py | 4 ++++ authentik/providers/scim/tests/test_user.py | 8 ++++++++ blueprints/system/providers-scim.yaml | 2 ++ 3 files changed, 14 insertions(+) diff --git a/authentik/providers/scim/tests/test_membership.py b/authentik/providers/scim/tests/test_membership.py index 76046e622..73754a569 100644 --- a/authentik/providers/scim/tests/test_membership.py +++ b/authentik/providers/scim/tests/test_membership.py @@ -82,9 +82,11 @@ class SCIMMembershipTests(TestCase): mocker.request_history[3].body, { "emails": [], + "active": True, "externalId": user.uid, "name": {"familyName": "", "formatted": "", "givenName": ""}, "photos": [], + "displayName": "", "userName": user.username, }, ) @@ -163,6 +165,8 @@ class SCIMMembershipTests(TestCase): self.assertJSONEqual( mocker.request_history[3].body, { + "active": True, + "displayName": "", "emails": [], "externalId": user.uid, "name": {"familyName": "", "formatted": "", "givenName": ""}, diff --git a/authentik/providers/scim/tests/test_user.py b/authentik/providers/scim/tests/test_user.py index 19d2088ed..36ce9b282 100644 --- a/authentik/providers/scim/tests/test_user.py +++ b/authentik/providers/scim/tests/test_user.py @@ -61,6 +61,7 @@ class SCIMUserTests(TestCase): self.assertJSONEqual( mock.request_history[1].body, { + "active": True, "emails": [ { "primary": True, @@ -74,6 +75,7 @@ class SCIMUserTests(TestCase): "formatted": uid, "givenName": uid, }, + "displayName": uid, "photos": [], "userName": uid, }, @@ -115,6 +117,7 @@ class SCIMUserTests(TestCase): self.assertEqual( body, { + "active": True, "emails": [ { "primary": True, @@ -122,6 +125,7 @@ class SCIMUserTests(TestCase): "value": f"{uid}@goauthentik.io", } ], + "displayName": uid, "externalId": user.uid, "name": { "familyName": "", @@ -166,6 +170,7 @@ class SCIMUserTests(TestCase): self.assertJSONEqual( mock.request_history[1].body, { + "active": True, "emails": [ { "primary": True, @@ -179,6 +184,7 @@ class SCIMUserTests(TestCase): "formatted": uid, "givenName": uid, }, + "displayName": uid, "photos": [], "userName": uid, }, @@ -232,6 +238,7 @@ class SCIMUserTests(TestCase): self.assertJSONEqual( mock.request_history[1].body, { + "active": True, "emails": [ { "primary": True, @@ -245,6 +252,7 @@ class SCIMUserTests(TestCase): "formatted": uid, "givenName": uid, }, + "displayName": uid, "photos": [], "userName": uid, }, diff --git a/blueprints/system/providers-scim.yaml b/blueprints/system/providers-scim.yaml index 5f7fc4b17..3c19145ac 100644 --- a/blueprints/system/providers-scim.yaml +++ b/blueprints/system/providers-scim.yaml @@ -43,8 +43,10 @@ entries: "givenName": givenName, "familyName": familyName, }, + "displayName": request.user.name, "photos": photos, "locale": locale, + "active": request.user.is_active, "emails": emails, } - identifiers: