2023-03-06 18:39:08 +00:00
|
|
|
version: 1
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
blueprints.goauthentik.io/system: "true"
|
|
|
|
name: System - SCIM Provider - Mappings
|
|
|
|
entries:
|
|
|
|
- identifiers:
|
|
|
|
managed: goauthentik.io/providers/scim/user
|
|
|
|
model: authentik_providers_scim.scimmapping
|
|
|
|
attrs:
|
|
|
|
name: "authentik default SCIM Mapping: User"
|
|
|
|
expression: |
|
|
|
|
# Some implementations require givenName and familyName to be set
|
2023-12-19 17:29:55 +00:00
|
|
|
givenName, familyName = request.user.name, " "
|
|
|
|
formatted = request.user.name + " "
|
2023-03-06 18:39:08 +00:00
|
|
|
# This default sets givenName to the name before the first space
|
|
|
|
# and the remainder as family name
|
|
|
|
# if the user's name has no space the givenName is the entire name
|
|
|
|
# (this might cause issues with some SCIM implementations)
|
|
|
|
if " " in request.user.name:
|
|
|
|
givenName, _, familyName = request.user.name.partition(" ")
|
2023-12-19 17:29:55 +00:00
|
|
|
formatted = request.user.name
|
2023-03-06 18:39:08 +00:00
|
|
|
|
|
|
|
# photos supports URLs to images, however authentik might return data URIs
|
|
|
|
avatar = request.user.avatar
|
2023-05-16 22:25:28 +00:00
|
|
|
photos = None
|
2023-03-06 18:39:08 +00:00
|
|
|
if "://" in avatar:
|
|
|
|
photos = [{"value": avatar, "type": "photo"}]
|
|
|
|
|
|
|
|
locale = request.user.locale()
|
|
|
|
if locale == "":
|
|
|
|
locale = None
|
|
|
|
|
|
|
|
emails = []
|
|
|
|
if request.user.email != "":
|
2023-05-16 22:25:28 +00:00
|
|
|
emails = [{
|
2023-03-06 18:39:08 +00:00
|
|
|
"value": request.user.email,
|
|
|
|
"type": "other",
|
|
|
|
"primary": True,
|
2023-05-16 22:25:28 +00:00
|
|
|
}]
|
2023-03-06 18:39:08 +00:00
|
|
|
return {
|
|
|
|
"userName": request.user.username,
|
|
|
|
"name": {
|
2023-12-19 17:29:55 +00:00
|
|
|
"formatted": formatted,
|
2023-03-06 18:39:08 +00:00
|
|
|
"givenName": givenName,
|
|
|
|
"familyName": familyName,
|
|
|
|
},
|
2023-03-28 12:42:52 +00:00
|
|
|
"displayName": request.user.name,
|
2023-03-06 18:39:08 +00:00
|
|
|
"photos": photos,
|
|
|
|
"locale": locale,
|
2023-03-28 12:42:52 +00:00
|
|
|
"active": request.user.is_active,
|
2023-03-06 18:39:08 +00:00
|
|
|
"emails": emails,
|
|
|
|
}
|
|
|
|
- identifiers:
|
|
|
|
managed: goauthentik.io/providers/scim/group
|
|
|
|
model: authentik_providers_scim.scimmapping
|
|
|
|
attrs:
|
|
|
|
name: "authentik default SCIM Mapping: Group"
|
|
|
|
expression: |
|
|
|
|
return {
|
|
|
|
"displayName": group.name,
|
|
|
|
}
|