providers/scim: add missing default fields (#5108)

* providers/scim: add missing default fields

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

#4554

* update tests

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

---------

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens L 2023-03-28 14:42:52 +02:00 committed by GitHub
parent b9754f9c13
commit 1d2725825c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 0 deletions

View File

@ -82,9 +82,11 @@ class SCIMMembershipTests(TestCase):
mocker.request_history[3].body, mocker.request_history[3].body,
{ {
"emails": [], "emails": [],
"active": True,
"externalId": user.uid, "externalId": user.uid,
"name": {"familyName": "", "formatted": "", "givenName": ""}, "name": {"familyName": "", "formatted": "", "givenName": ""},
"photos": [], "photos": [],
"displayName": "",
"userName": user.username, "userName": user.username,
}, },
) )
@ -163,6 +165,8 @@ class SCIMMembershipTests(TestCase):
self.assertJSONEqual( self.assertJSONEqual(
mocker.request_history[3].body, mocker.request_history[3].body,
{ {
"active": True,
"displayName": "",
"emails": [], "emails": [],
"externalId": user.uid, "externalId": user.uid,
"name": {"familyName": "", "formatted": "", "givenName": ""}, "name": {"familyName": "", "formatted": "", "givenName": ""},

View File

@ -61,6 +61,7 @@ class SCIMUserTests(TestCase):
self.assertJSONEqual( self.assertJSONEqual(
mock.request_history[1].body, mock.request_history[1].body,
{ {
"active": True,
"emails": [ "emails": [
{ {
"primary": True, "primary": True,
@ -74,6 +75,7 @@ class SCIMUserTests(TestCase):
"formatted": uid, "formatted": uid,
"givenName": uid, "givenName": uid,
}, },
"displayName": uid,
"photos": [], "photos": [],
"userName": uid, "userName": uid,
}, },
@ -115,6 +117,7 @@ class SCIMUserTests(TestCase):
self.assertEqual( self.assertEqual(
body, body,
{ {
"active": True,
"emails": [ "emails": [
{ {
"primary": True, "primary": True,
@ -122,6 +125,7 @@ class SCIMUserTests(TestCase):
"value": f"{uid}@goauthentik.io", "value": f"{uid}@goauthentik.io",
} }
], ],
"displayName": uid,
"externalId": user.uid, "externalId": user.uid,
"name": { "name": {
"familyName": "", "familyName": "",
@ -166,6 +170,7 @@ class SCIMUserTests(TestCase):
self.assertJSONEqual( self.assertJSONEqual(
mock.request_history[1].body, mock.request_history[1].body,
{ {
"active": True,
"emails": [ "emails": [
{ {
"primary": True, "primary": True,
@ -179,6 +184,7 @@ class SCIMUserTests(TestCase):
"formatted": uid, "formatted": uid,
"givenName": uid, "givenName": uid,
}, },
"displayName": uid,
"photos": [], "photos": [],
"userName": uid, "userName": uid,
}, },
@ -232,6 +238,7 @@ class SCIMUserTests(TestCase):
self.assertJSONEqual( self.assertJSONEqual(
mock.request_history[1].body, mock.request_history[1].body,
{ {
"active": True,
"emails": [ "emails": [
{ {
"primary": True, "primary": True,
@ -245,6 +252,7 @@ class SCIMUserTests(TestCase):
"formatted": uid, "formatted": uid,
"givenName": uid, "givenName": uid,
}, },
"displayName": uid,
"photos": [], "photos": [],
"userName": uid, "userName": uid,
}, },

View File

@ -43,8 +43,10 @@ entries:
"givenName": givenName, "givenName": givenName,
"familyName": familyName, "familyName": familyName,
}, },
"displayName": request.user.name,
"photos": photos, "photos": photos,
"locale": locale, "locale": locale,
"active": request.user.is_active,
"emails": emails, "emails": emails,
} }
- identifiers: - identifiers: