* @param ldapSession the LdapSession instance
*/
protected void insertSaslFilter( LdapSession ldapSession )
{
LOG.debug( "Inserting SaslFilter to engage negotiated security layer." );
IoSession ioSession = ldapSession.getIoSession();
// get the Io chain
IoFilterChain chain = ioSession.getFilterChain();
if ( !chain.contains( SaslConstants.SASL_FILTER ) )
{
SaslServer saslServer = ( SaslServer ) ldapSession.getSaslProperty( SaslConstants.SASL_SERVER );
chain.addBefore( "codec", SaslConstants.SASL_FILTER, new SaslFilter( saslServer ) );
}
/*
* We disable the SASL security layer once, to write the outbound SUCCESS
* message without SASL security layer processing.
*/
ioSession.setAttribute( SaslFilter.DISABLE_SECURITY_LAYER_ONCE, Boolean.TRUE );
}