Authenticating your web applications with LDAP and .htaccess
Posted on January 3rd, 2009 by Shibu BasheerHere is a trick to have your web applications that run on apache servers to authenticate using a LDAP server. Note, your apache server should support .htaccess. This is useful when you want to restrict certain applications to authorised users in a network.
Create a .htaccess file in the root of your application with the following content. Please put in the appropriate values for AuthLDAPURL.
AuthBasicProvider ldap
AuthzLDAPAuthoritative off
AuthType Basic
AuthName “Enter your userid and password :”
AuthLDAPURL “ldap://your.ldap.server/dc=domain,dc=com?uid?sub?(objectClass=*)
Require valid-user
You may restrict access to specific users by repacing “Require valid-user” with something like “Require john, harry”. In this case only john and harry can access the application.
Tags: apache
