LOG.debug( "Nexus succeeded on bind operation." );
// bind succeeded if we got this far
// TODO - authentication level not being set
LdapPrincipal principal = new LdapPrincipal( opContext.getDn(), AuthenticationLevel.SIMPLE );
CoreSession session = new DefaultCoreSession( principal, directoryService );
opContext.setSession( session );
// remove creds so there is no security risk
opContext.setCredentials( null );
return;
}
// TODO : we should refactor that.
// try each authenticator
for ( Authenticator authenticator : authenticators )
{
try
{
// perform the authentication
LdapPrincipal principal = authenticator.authenticate( opContext );
LdapPrincipal clonedPrincipal = (LdapPrincipal)(principal.clone());
// remove creds so there is no security risk
opContext.setCredentials( null );
clonedPrincipal.setUserPassword( StringTools.EMPTY_BYTES );
// authentication was successful
CoreSession session = new DefaultCoreSession( clonedPrincipal, directoryService );
opContext.setSession( session );
return;
}
catch ( LdapAuthenticationException e )