JAAS with active directory authentication in a web application

This is a sample to use JAAS authentication with a windows active directory server. I use a Sun Java System Application Server, so the steps with other servers could be different. Step 1: Defining LDAP realm In this example you must define a LDAP realm named «ads-realm» with the following parameters: Realm class: com.sun.enterprise.security.auth.realm.ldap.LDAPReam Properties: directory = ldap://ads.host.name:389 base-dn = DC=ads,DC=domain,DC=com search-bind-dn = user search-bind-password = password search-filter = (&(objectClass=user)(sAMAccountName=%s)) group-search-filter = (&(objectClass=group)(member=%d)) jaas-context = ldapRealm You must change directory, base-dn, search-bind-dn and search-bind-password to your active directory configuration. The «search-bind-dn» and «search-bind-password» parameters are needed, because with default settings[…]

Read more