Apache LDAP authentication

Started by samy, April 22, 2017, 01:07:12 PM

Previous topic - Next topic

samy

 0
down vote
favorite
1
   

i have configured apache with Active directory to perform authentication for a web page, everything works perfectly, when the user enter the username and password, Apache validate it against AD and it works. The thing which is not working is that when the user enter the domain e.g. domain\username instead of only username, Apache won't be able to authenticate it, it says not allowed.

i would like to strip the domain using RewriteCondition or something similar, i mean if the user enter the domain\username, Apache should keep only username and remove the "domain\" any help / hint from you? thanks in advance.

ProxyPass "/sso" "http://webserver1/sso" timeout=30
ProxyPassReverse "http://webserver1/sso" "/sso"

<Location "/sso">
LDAPReferrals off
AuthType Basic
AuthName "Web Application"
require valid-user
RequestHeader unset username
RewriteEngine On
RewriteCond %{LA-U:REMOTE_USER} (.+)
RewriteRule .* - [E=RU:%1]
RequestHeader add username %{RU}e
AuthLDAPBindDN "CN=queryuser,CN=Users,DC=activdir01,DC=us,DC=com" AuthLDAPURL "ldap://127.0.0.1:389 /CN=Users,DC=activdir01,DC=us,DC=com?sAMAccountName?sub?(objectClass=*)"
AuthLDAPBindPassword "Password"
AuthBasicProvider ldap
</Location>