This project has retired. For details please refer to its Attic page.
Apache Redback – Ldap Integration Fork me on GitHub

Redback Ldap Integration

Redback has limited support for ldap has been added as an authentication source. Limited support for ldap means:

  • Read-Only User Management
  • xml and properties based configuration
  • tested against open ldap on linux and apacheds 1.5.0/2.0.0 and OpenDj

Setting up Ldap

Configuration for ldap is actually a relatively simple procedure, a few components definitions need to be declared in an appropriate application.xml and then some configuration options must be set in the security.properties file.

The applicationContext.xml Additions

These components should be defined in the applicable spring configuration files

ldap connection factory
  <bean name="ldapConnectionFactory" class="org.apache.archiva.redback.common.ldap.connection.ConfigurableLdapConnectionFactory">
    <property name="userConf" ref="userConfiguration"/>
  </bean>
    

In security.properties files

  • ldap.config.hostname - The hostname of the ldap server
  • ldap.config.port - The port of the ldap server
  • ldap.config.base.dn - The baseDn of the ldap system
  • ldap.config.context.factory - context factory for ldap connections (com.sun.jndi.ldap.LdapCtxFactory)
  • ldap.config.password - password for the bindDn for the root ldap connection
  • ldap.config.bind.dn - the core user used for authentication the ldap server, must be able to perform the necessary searches, etc.
user mapper
        
    <bean name="ldapUserMapper" class="org.apache.archiva.redback.common.ldap.user.LdapUserMapper">
      <property name="emailAttribute" value="email"/>
      <property name="fullNameAttribute" value="givenName"/>
      <property name="passwordAttribute" value="userPassword"/>
      <property name="userIdAttribute" value="cn"/>
      <property name="userBaseDn" value="o=com"/>
      <property name="userObjectClass" value="inetOrgPerson"/>
      <property name="userConf" ref="userConfiguration"/>
    </bean>
    

In security.properties

  • ldap.config.mapper.attribute.email - The name of the attribute on a user that contains the email address
  • ldap.config.mapper.attribute.fullname - The name of the attribute on a user that contains the users fullName
  • ldap.config.mapper.attribute.password - The name of the attribute containing the users password, used for the authentiction using the user manager and not the ldap bind authenticator
  • ldap.config.mapper.attribute.user.id - The name of the attribute containing the users userId, most commonly cn or sn.
  • ldap.config.mapper.attribute.user.base.dn - The base dn that will be subtree searched for users.
  • ldap.config.mapper.attribute.user.object.class - the objectClass used in the ldap server for indentifying users, most commonly inetOrgPerson.
  • ldap.config.mapper.attribute.user.filter - the user filter is used to reduce the number of results during a LDAP request. It is optional.
security policy (for the password encoder)
  
    <bean name="userSecurityPolicy" class="org.apache.archiva.redback.policy.DefaultUserSecurityPolicy">
      <property name="config" ref="userConfiguration"/>
      <property name="passwordEncoder" ref="passwordEncoder#sha1"/>
      <property name="userValidationSettings" ref="userValidationSettings"/>
      <property name="rememberMeCookieSettings" ref="cookieSettings#rememberMe"/>
      <property name="signonCookieSettings" ref="cookieSettings#signon"/>
      <property name="rules">
        add the rules you want to applied
        <list>
          <ref bean="passwordRule#alpha-count"/>
          <ref bean="passwordRule#alpha-numeric"/>
          <ref bean="passwordRule#character-length"/>
          <ref bean="passwordRule#must-have"/>
          <ref bean="passwordRule#no-whitespaces"/>
          <ref bean="passwordRule#numerical-count"/>
        </list>
      </property>
    </bean>

security.properties

These properties should be set as shown:

user.manager.impl=ldap
ldap.bind.authenticator.enabled=true
redback.default.admin=admin
redback.default.guest=guest
security.policy.password.expiration.enabled=false

The user.manager.impl is the role hint that is used to determine which user manaher to use while running. The default is 'cached' and if this is desired to be used with ldap then you must include the component declartion below in the caching section for the cached UserManager that sets the underlying userImpl to ldap.

The ldap.bind.authenitcator.enabled boolean value will toggle the use of authenticator that will authenticate using the bind operation. There are two different mechanisms used to authenticate with ldap, either the bind authenticator which is a standard way to authentication, and then the user manager password validation approach. If this is desired then you must ensure that the security policy is configured to use the correct password encoding. Normally the bind authenticator is simply enabled since this bypasses concerns of password encoding.

It is also now possible to redefine the basic admin user and guest user names. Since its unlikely that ldap oriented authentication systems will have a specific admin or guest user these can be redefined simply in the security.properties. Care must be taken that they exist in the ldap system since they are looked up. Guest users can be simple utilitie or application users.

The final setting of security.policy.password.expiration.enabled is a boolean that should be set to false for ldap based authentication. This is because redback will want to attempt to manage and enforce password expiration and that is no longer under the direction of redback but is an artifact of the ldap system in place. Setting this to false prevents issues from cropping up related to redback trying to obtain this type of information.

Caching

A cache named 'ldapUser' is used to reduce access to the LDAP server.

Pooled connection are enabled per default using the properties ldap pooling:

  • com.sun.jndi.ldap.connect.pool = true
  • com.sun.jndi.ldap.connect.pool.timeout = 3600

For advanced options see advanced configuration.