Typically the AD main.ldapRealm.userDnTemplate value looks slightly different than
OpenLDAP. The value for main.ldapRealm.userDnTemplate is only
required if AD authentication requires the full User DN.
![]() | Note |
|---|---|
If AD can allows authentication based on the CN (common name) and password
only, no value is required for
|
The following is an example provider configuration for Active Directory (AD):
<provider>
<role>authentication</role>
<name>ShiroProvider</name>
<enabled>true</enabled>
<param>
<name>main.ldapRealm</name>
<value>org.apache.shiro.realm.ldap.JndiLdapRealm</value>
</param>
<param>
<name>main.ldapRealm.userDnTemplate</name>
<value>cn={0},ou=people,dc=hadoop,dc=apache,dc=org</value>
</param>
<param>
<name>main.ldapRealm.contextFactory.url</name>
<value>ldap://localhost:389</value>
</param>
<param>
<name>main.ldapRealm.contextFactory.authenticationMechanism</name>
<value>simple</value>
</param>
<param>
<name>urls./**</name>
<value>authcBasic</value>
</param>
</provider>
![[Note]](../common/images/admon/note.png)
