version: 1
metadata:
labels:
blueprints.goauthentik.io/system: "true"
name: System - LDAP Source - Mappings
entries:
- 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
managed: goauthentik.io/sources/ldap/default-name
name: "authentik default LDAP Mapping: Name"
object_field: "name"
return ldap.get('name')
managed: goauthentik.io/sources/ldap/default-mail
name: "authentik default LDAP Mapping: mail"
object_field: "email"
return ldap.get('mail')
# ActiveDirectory-specific mappings
managed: goauthentik.io/sources/ldap/ms-samaccountname
name: "authentik default Active Directory Mapping: sAMAccountName"
object_field: "username"
return ldap.get('sAMAccountName')
managed: goauthentik.io/sources/ldap/ms-userprincipalname
name: "authentik default Active Directory Mapping: userPrincipalName"
object_field: "attributes.upn"
return list_flatten(ldap.get('userPrincipalName'))
managed: goauthentik.io/sources/ldap/ms-givenName
name: "authentik default Active Directory Mapping: givenName"
object_field: "attributes.givenName"
return list_flatten(ldap.get('givenName'))
managed: goauthentik.io/sources/ldap/ms-sn
name: "authentik default Active Directory Mapping: sn"
object_field: "attributes.sn"
return list_flatten(ldap.get('sn'))
# OpenLDAP specific mappings
managed: goauthentik.io/sources/ldap/openldap-uid
name: "authentik default OpenLDAP Mapping: uid"
return ldap.get('uid')
managed: goauthentik.io/sources/ldap/openldap-cn
name: "authentik default OpenLDAP Mapping: cn"
return ldap.get('cn')