Skip to content

Commit 5ff292b

Browse files
committed
AUTH_LDAP_BIND_AS_AUTHENTICATING_USER is now loaded from environment
1 parent f80cc70 commit 5ff292b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

configuration/ldap/ldap_config.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,12 @@ def _import_group_type(group_type_name):
3131
ldap.OPT_REFERRALS: 0
3232
}
3333

34-
# Set the DN and password for the NetBox service account.
35-
AUTH_LDAP_BIND_DN = environ.get('AUTH_LDAP_BIND_DN', '')
36-
AUTH_LDAP_BIND_PASSWORD = _read_secret('auth_ldap_bind_password', environ.get('AUTH_LDAP_BIND_PASSWORD', ''))
34+
AUTH_LDAP_BIND_AS_AUTHENTICATING_USER = environ.get('AUTH_LDAP_BIND_AS_AUTHENTICATING_USER', 'True').lower() == 'true'
35+
36+
# Set the DN and password for the NetBox service account if needed.
37+
if not AUTH_LDAP_BIND_AS_AUTHENTICATING_USER:
38+
AUTH_LDAP_BIND_DN = environ.get('AUTH_LDAP_BIND_DN', '')
39+
AUTH_LDAP_BIND_PASSWORD = _read_secret('auth_ldap_bind_password', environ.get('AUTH_LDAP_BIND_PASSWORD', ''))
3740

3841
# Set a string template that describes any user’s distinguished name based on the username.
3942
AUTH_LDAP_USER_DN_TEMPLATE = environ.get('AUTH_LDAP_USER_DN_TEMPLATE', None)

0 commit comments

Comments
 (0)