Specifying userDnPatterns Parameters

If you have a fixed structure of user entries and the login name of the user appears in the RDN of your user entries, you can easily configure the BindAuthenticator bean with patterns to match them:

In sample-applicationContext-externalAuth-LDAP[-mt].xml, locate the ldapAuthenticationProvider bean. The unnamed bean of class BindAuthenticator is the first constructor argument.

In the properties that configure BindAuthenticator, the userDnPatterns property contains a list of values that give patterns for matching the RDNs of user entries. For each value in the list, the server substitutes the login name entered by the user for the {0} placeholder, then creates a DN by appending the base DN from the LDAP URL. The LDAP URL is specified in Setting the LDAP Connection Parameters.

JasperReports Server attempts to bind to the LDAP directory with the DN created with each pattern in the order they are given.

In the example below, JasperReports Server looks for a user whose given login name appears in the uid attribute of the RDN in the ou=users branch of the LDAP directory:

<bean id="ldapAuthenticationProvider"
      <constructor-arg><ref local="ldapContextSource"/></constructor-arg>
      <property name="userDnPatterns">