12

I'm currently trying to map automatically user groups in LDAP to user roles in a flask AppBuilder framework based application but can't come up with a solution. I have read through the entire flask AppBuilder documentation and didn't find anything related to this. Here is the basic configuration I have come up with. I don't know how I could map different roles to different user groups.

AUTH_TYPE = AUTH_LDAP
AUTH_LDAP_SERVER = "ldap://ldapserver.local"
AUTH_LDAP_USE_TLS = False
AUTH_LDAP_SEARCH = "dc=domain,dc=local"
AUTH_LDAP_BIND_USER = "CN=Query User,OU=People,dc=domain,dc=local"
AUTH_LDAP_BIND_PASSWORD = "password"
AUTH_USER_REGISTRATION = True
AUTH_USER_REGISTRATION_ROLE = "Admin"
IMSoP
  • 89,526
  • 13
  • 117
  • 169
Stackgeek
  • 227
  • 1
  • 12
  • 1
    Did you ever found the correct configuration? I'm trying to configure my apache airflow server and can't seem to find the correct settings for our AD server. – Alexis Lessard Sep 05 '19 at 19:35

1 Answers1

0

airflow 2.1.1

WTF_CSRF_ENABLED = True
AUTH_TYPE = AUTH_LDAP
AUTH_ROLE_ADMIN = 'Admin'
AUTH_USER_REGISTRATION = True

AUTH_USER_REGISTRATION_ROLE = "Public"

AUTH_LDAP_USE_TLS = False
AUTH_LDAP_SERVER = "ldap://ldapserver.local:389"

AUTH_LDAP_SEARCH = "OU=Users,DC=ldapserver,DC=local"

AUTH_LDAP_BIND_USER = "CN=Query User,OU=People,dc=ldapserver,dc=local"
AUTH_LDAP_BIND_PASSWORD = "password"

AUTH_LDAP_UID_FIELD = "sAMAccountName"

AUTH_ROLES_MAPPING = {
    "CN=group_1_name,OU=Groups,DC=ldapserver,DC=local": ["Admin"],
    "CN=group_2_name,OU=Groups,DC=ldapserver,DC=local": ["Viewer"],
}

AUTH_LDAP_GROUP_FIELD = "memberOf"
AUTH_ROLES_SYNC_AT_LOGIN = False
PERMANENT_SESSION_LIFETIME = 1800
Ivan
  • 1