Skip to content

Commit 262ff22

Browse files
committed
LDAP: Add support for domain-based login
With the new environment variable LDAP_DOMAIN. It is only used, if the auth_method user is selected. Then the domain session controller sets the domain field of the ldap_config which is then used in blindsidenetworks/bn-ldap-authentication#8 to build the bindRequest username like so: DOMAIN\USERNAME.
1 parent 50c2070 commit 262ff22

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

app/controllers/sessions_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ def ldap
137137
ldap_config[:base] = ENV['LDAP_BASE']
138138
ldap_config[:filter] = ENV['LDAP_FILTER']
139139
ldap_config[:uid] = ENV['LDAP_UID']
140+
ldap_config[:domain] = ENV['LDAP_DOMAIN']
140141

141142
if params[:session][:username].blank? || session_params[:password].blank?
142143
return redirect_to(ldap_signin_path, alert: I18n.t("invalid_credentials"))

sample.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ OAUTH2_REDIRECT=
7272
# LDAP_BIND_DN=cn=admin,dc=example,dc=com
7373
# LDAP_PASSWORD=password
7474
# LDAP_ROLE_FIELD=ou
75+
# LDAP_DOMAIN=domainname
7576
# LDAP_FILTER=(&(attr1=value1)(attr2=value2))
7677
# LDAP_ATTRIBUTE_MAPPING=name=displayName;uid=uid; (See link above for more details)
7778
LDAP_SERVER=
@@ -83,6 +84,7 @@ LDAP_BIND_DN=
8384
LDAP_AUTH=
8485
LDAP_PASSWORD=
8586
LDAP_ROLE_FIELD=
87+
LDAP_DOMAIN=
8688
LDAP_FILTER=
8789
LDAP_ATTRIBUTE_MAPPING=
8890

0 commit comments

Comments
 (0)