2022-08-01 21:05:58 +00:00
|
|
|
version: 1
|
2022-08-02 22:05:49 +00:00
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
blueprints.goauthentik.io/system: "true"
|
|
|
|
name: System - LDAP Source - Mappings
|
2022-08-01 21:05:58 +00:00
|
|
|
entries:
|
2023-09-26 16:55:33 +00:00
|
|
|
- identifiers:
|
|
|
|
managed: goauthentik.io/sources/ldap/default-dn-path
|
|
|
|
model: authentik_sources_ldap.ldappropertymapping
|
|
|
|
attrs:
|
|
|
|
name: "authentik default LDAP Mapping: DN to User Path"
|
|
|
|
object_field: "path"
|
|
|
|
expression: |
|
|
|
|
dn = ldap.get("distinguishedName")
|
|
|
|
path_elements = []
|
|
|
|
for pair in dn.split(","):
|
|
|
|
attr, _, value = pair.partition("=")
|
|
|
|
# Ignore elements from the Root DSE and the canonical name of the object
|
|
|
|
if attr.lower() in ["cn", "dc"]:
|
|
|
|
continue
|
|
|
|
path_elements.append(value)
|
|
|
|
path_elements.reverse()
|
|
|
|
|
|
|
|
path = source.get_user_path()
|
|
|
|
if len(path_elements) > 0:
|
|
|
|
path = f"{path}/{'/'.join(path_elements)}"
|
|
|
|
return path
|
2022-08-01 21:05:58 +00:00
|
|
|
- identifiers:
|
|
|
|
managed: goauthentik.io/sources/ldap/default-name
|
2022-08-08 18:38:42 +00:00
|
|
|
model: authentik_sources_ldap.ldappropertymapping
|
2022-08-01 21:05:58 +00:00
|
|
|
attrs:
|
|
|
|
name: "authentik default LDAP Mapping: Name"
|
|
|
|
object_field: "name"
|
|
|
|
expression: |
|
|
|
|
return ldap.get('name')
|
|
|
|
- identifiers:
|
|
|
|
managed: goauthentik.io/sources/ldap/default-mail
|
2022-08-08 18:38:42 +00:00
|
|
|
model: authentik_sources_ldap.ldappropertymapping
|
2022-08-01 21:05:58 +00:00
|
|
|
attrs:
|
|
|
|
name: "authentik default LDAP Mapping: mail"
|
|
|
|
object_field: "email"
|
|
|
|
expression: |
|
|
|
|
return ldap.get('mail')
|
|
|
|
# ActiveDirectory-specific mappings
|
|
|
|
- identifiers:
|
|
|
|
managed: goauthentik.io/sources/ldap/ms-samaccountname
|
2022-08-08 18:38:42 +00:00
|
|
|
model: authentik_sources_ldap.ldappropertymapping
|
2022-08-01 21:05:58 +00:00
|
|
|
attrs:
|
|
|
|
name: "authentik default Active Directory Mapping: sAMAccountName"
|
|
|
|
object_field: "username"
|
|
|
|
expression: |
|
|
|
|
return ldap.get('sAMAccountName')
|
|
|
|
- identifiers:
|
|
|
|
managed: goauthentik.io/sources/ldap/ms-userprincipalname
|
2022-08-08 18:38:42 +00:00
|
|
|
model: authentik_sources_ldap.ldappropertymapping
|
2022-08-01 21:05:58 +00:00
|
|
|
attrs:
|
|
|
|
name: "authentik default Active Directory Mapping: userPrincipalName"
|
|
|
|
object_field: "attributes.upn"
|
|
|
|
expression: |
|
|
|
|
return list_flatten(ldap.get('userPrincipalName'))
|
|
|
|
- identifiers:
|
|
|
|
managed: goauthentik.io/sources/ldap/ms-givenName
|
2022-08-08 18:38:42 +00:00
|
|
|
model: authentik_sources_ldap.ldappropertymapping
|
2022-08-01 21:05:58 +00:00
|
|
|
attrs:
|
|
|
|
name: "authentik default Active Directory Mapping: givenName"
|
|
|
|
object_field: "attributes.givenName"
|
|
|
|
expression: |
|
|
|
|
return list_flatten(ldap.get('givenName'))
|
|
|
|
- identifiers:
|
|
|
|
managed: goauthentik.io/sources/ldap/ms-sn
|
2022-08-08 18:38:42 +00:00
|
|
|
model: authentik_sources_ldap.ldappropertymapping
|
2022-08-01 21:05:58 +00:00
|
|
|
attrs:
|
|
|
|
name: "authentik default Active Directory Mapping: sn"
|
|
|
|
object_field: "attributes.sn"
|
|
|
|
expression: |
|
|
|
|
return list_flatten(ldap.get('sn'))
|
|
|
|
# OpenLDAP specific mappings
|
|
|
|
- identifiers:
|
|
|
|
managed: goauthentik.io/sources/ldap/openldap-uid
|
2022-08-08 18:38:42 +00:00
|
|
|
model: authentik_sources_ldap.ldappropertymapping
|
2022-08-01 21:05:58 +00:00
|
|
|
attrs:
|
|
|
|
name: "authentik default OpenLDAP Mapping: uid"
|
|
|
|
object_field: "username"
|
|
|
|
expression: |
|
|
|
|
return ldap.get('uid')
|
|
|
|
- identifiers:
|
|
|
|
managed: goauthentik.io/sources/ldap/openldap-cn
|
2022-08-08 18:38:42 +00:00
|
|
|
model: authentik_sources_ldap.ldappropertymapping
|
2022-08-01 21:05:58 +00:00
|
|
|
attrs:
|
|
|
|
name: "authentik default OpenLDAP Mapping: cn"
|
|
|
|
object_field: "name"
|
|
|
|
expression: |
|
|
|
|
return ldap.get('cn')
|