Skip to content
Snippets Groups Projects
Verified Commit cc02534f authored by Ernesto Rico Schmidt's avatar Ernesto Rico Schmidt
Browse files

feat: get AUTH_LDAP_* from the environment

parent c2f80732
No related branches found
No related tags found
1 merge request!29Use docker main tag
......@@ -182,36 +182,36 @@ FILTER_ACTIVE_SHOWS_USING = {
# WSGI_APPLICATION = 'steering.wsgi.application';
if os.getenv("USE_LDAP_AUTH"):
# we don't have defaults for these because they are set in docker-compose
AUTHENTICATION_BACKENDS = (
"django_auth_ldap.backend.LDAPBackend",
"django.contrib.auth.backends.ModelBackend",
)
AUTH_LDAP_SERVER_URI = "ldap://ldap.local"
AUTH_LDAP_BIND_DN = "cn=reader,dc=local"
AUTH_LDAP_ALWAYS_UPDATE_USER = os.getenv("AUTH_LDAP_ALWAYS_UPDATE_USER")
AUTH_LDAP_BIND_DN = os.getenv("AUTH_LDAP_BIND_DN")
AUTH_LDAP_BIND_PASSWORD = os.getenv("AUTH_LDAP_BIND_PASSWORD")
AUTH_LDAP_USER_DN_TEMPLATE = "uid=%(user)s,ou=users,dc=local"
AUTH_LDAP_FIND_GROUP_PERMS = os.getenv("AUTH_LDAP_FIND_GROUP_PERMS")
AUTH_LDAP_GROUP_SEARCH = LDAPSearch(
"ou=groups,dc=local",
ldap.SCOPE_SUBTREE,
"(objectClass=posixGroup)",
base_dn=os.getenv("AUTH_LDAP_GROUP_SEARCH_BASE_DN"),
scope=ldap.SCOPE_SUBTREE,
filterstr=os.getenv("AUTH_LDAP_GROUP_SEARCH_FILTERSTR"),
)
AUTH_LDAP_GROUP_TYPE = PosixGroupType()
AUTH_LDAP_MIRROR_GROUPS = os.getenv("AUTH_LDAP_MIRROR_GROUPS")
AUTH_LDAP_SERVER_URI = os.getenv("AUTH_LDAP_SERVER_URI")
AUTH_LDAP_USER_ATTR_MAP = {
"first_name": "givenName",
"last_name": "sn",
"email": "mail",
"first_name": os.getenv("AUTH_LDAP_USER_ATTR_MAP_FIRST_NAME"),
"last_name": os.getenv("AUTH_LDAP_USER_ATTR_MAP_LAST_NAME"),
"email": os.getenv("AUTH_LDAP_USER_ATTR_MAP_EMAIL"),
}
AUTH_LDAP_USER_DN_TEMPLATE = os.getenv("AUTH_LDAP_USER_DN_TEMPLATE")
AUTH_LDAP_USER_FLAGS_BY_GROUP = {
"is_active": "cn=active,ou=django,ou=groups,dc=local",
"is_staff": "cn=staff,ou=django,ou=groups,dc=local",
"is_superuser": "cn=superuser,ou=django,ou=groups,dc=local",
"is_active": os.getenv("AUTH_LDAP_USER_FLAGS_BY_GROUP_ACTIVE"),
"is_staff": os.getenv("AUTH_LDAP_USER_FLAGS_BY_GROUP_STAFF"),
"is_superuser": os.getenv("AUTH_LDAP_USER_FLAGS_BY_GROUP_SUPERUSER"),
}
AUTH_LDAP_ALWAYS_UPDATE_USER = True
AUTH_LDAP_FIND_GROUP_PERMS = True
AUTH_LDAP_MIRROR_GROUPS = True
# SITE_URL is used by django-oidc-provider and openid-configuration will break not set correctly
PORT = os.getenv("STEERING_PORT")
AURA_PROTO = os.getenv("AURA_PROTO", default="http")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment