bindContext.setDn( bindRequest.getDn() );
bindContext.setInterceptors( directoryService.getInterceptors( OperationEnum.BIND ) );
OperationManager operationManager = directoryService.getOperationManager();
BindResponse bindResp = new BindResponseImpl( newId );
bindResp.getLdapResult().setResultCode( ResultCodeEnum.SUCCESS );
try
{
if ( !bindRequest.isSimple() )
{
bindContext.setSaslMechanism( bindRequest.getSaslMechanism() );
}
operationManager.bind( bindContext );
session = bindContext.getSession();
bindResp.addAllControls( bindContext.getResponseControls() );
}
catch ( LdapOperationException e )
{
LOG.warn( e.getMessage(), e );
LdapResult res = bindResp.getLdapResult();
res.setDiagnosticMessage( e.getMessage() );
res.setResultCode( e.getResultCode() );
}
return bindResp;