本文整理汇总了Java中org.apache.directory.api.ldap.model.message.BindResponse.setServerSaslCreds方法的典型用法代码示例。如果您正苦于以下问题:Java BindResponse.setServerSaslCreds方法的具体用法?Java BindResponse.setServerSaslCreds怎么用?Java BindResponse.setServerSaslCreds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.directory.api.ldap.model.message.BindResponse
的用法示例。
在下文中一共展示了BindResponse.setServerSaslCreds方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: action
import org.apache.directory.api.ldap.model.message.BindResponse; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public void action( LdapMessageContainer<BindResponseDecorator> container ) throws DecoderException
{
// Get the Value and store it in the BindRequest
TLV tlv = container.getCurrentTLV();
// We have to handle the special case of a 0 length server
// sasl credentials
byte[] serverSaslCreds;
if ( tlv.getLength() == 0 )
{
serverSaslCreds = Strings.EMPTY_BYTES;
}
else
{
serverSaslCreds = tlv.getValue().getData();
}
BindResponse response = container.getMessage();
response.setServerSaslCreds( serverSaslCreds );
// We can have an END transition
container.setGrammarEndAllowed( true );
if ( IS_DEBUG )
{
LOG.debug( "The SASL credentials value is : {}", Strings.dumpBytes( serverSaslCreds ) );
}
}
示例2: sendBindSuccess
import org.apache.directory.api.ldap.model.message.BindResponse; //导入方法依赖的package包/类
/**
* Send a SUCCESS message back to the client.
*/
private void sendBindSuccess( LdapSession ldapSession, BindRequest bindRequest, byte[] tokenBytes )
{
// Return the successful response
BindResponse response = bindRequest.getResultResponse();
response.getLdapResult().setResultCode( ResultCodeEnum.SUCCESS );
response.setServerSaslCreds( tokenBytes );
if ( !ldapSession.getCoreSession().isAnonymous() )
{
// If we have not been asked to authenticate as Anonymous, authenticate the user
ldapSession.setAuthenticated();
}
else
{
// Otherwise, switch back to Anonymous
ldapSession.setAnonymous();
}
// Clean the SaslProperties, we don't need them anymore
MechanismHandler handler = ( MechanismHandler ) ldapSession.getSaslProperty( SaslConstants.SASL_MECH_HANDLER );
if ( handler != null )
{
handler.cleanup( ldapSession );
}
ldapSession.getIoSession().write( response );
LOG.debug( "Returned SUCCESS message: {}.", response );
}
示例3: sendBindSuccess
import org.apache.directory.api.ldap.model.message.BindResponse; //导入方法依赖的package包/类
/**
* Send a SUCCESS message back to the client.
*/
private void sendBindSuccess( LdapSession ldapSession, BindRequest bindRequest, byte[] tokenBytes )
{
// Return the successful response
BindResponse response = ( BindResponse ) bindRequest.getResultResponse();
response.getLdapResult().setResultCode( ResultCodeEnum.SUCCESS );
response.setServerSaslCreds( tokenBytes );
if ( !ldapSession.getCoreSession().isAnonymous() )
{
// If we have not been asked to authenticate as Anonymous, authenticate the user
ldapSession.setAuthenticated();
}
else
{
// Otherwise, switch back to Anonymous
ldapSession.setAnonymous();
}
// Clean the SaslProperties, we don't need them anymore
MechanismHandler handler = ( MechanismHandler ) ldapSession.getSaslProperty( SaslConstants.SASL_MECH_HANDLER );
if ( handler != null )
{
handler.cleanup( ldapSession );
}
ldapSession.getIoSession().write( response );
LOG.debug( "Returned SUCCESS message: {}.", response );
}