}
catch ( LdapException le )
{
String message = I18n.err( I18n.ERR_230, bindContext.getDn().getName() );
LOG.info( message );
throw new LdapAuthenticationException( message );
}
// Create the new principal
principal = new LdapPrincipal( getDirectoryService().getSchemaManager(), bindContext.getDn(),
AuthenticationLevel.SIMPLE,
bindContext.getCredentials() );
IoSession session = bindContext.getIoSession();
if ( session != null )
{
SocketAddress clientAddress = session.getRemoteAddress();
principal.setClientAddress( clientAddress );
SocketAddress serverAddress = session.getServiceAddress();
principal.setServerAddress( serverAddress );
}
return principal;
}
catch ( LdapException e )
{
// Bad password ...
String message = I18n.err( I18n.ERR_230, bindContext.getDn().getName() );
LOG.info( message );
throw new LdapAuthenticationException( message );
}
finally
{
ldapConnection.close();
}