/** * Transform a BindResponse message from a CodecMessage to a * InternalMessage. This is used by clients which are receiving a * BindResponse PDU and must decode it to return the Internal * representation. * * @param bindResponse The message to transform * @param messageId The message Id * @return a Internal BindResponseImpl */ private static InternalMessage transformBindResponse( BindResponseCodec bindResponse, int messageId ) { BindResponseImpl internalMessage = new BindResponseImpl( messageId ); // Codec : byte[] serverSaslcreds -> Internal : byte[] serverSaslCreds internalMessage.setServerSaslCreds( bindResponse.getServerSaslCreds() ); //transformControlsCodecToInternal( codecMessage, internalMessage ); transformLdapResultCodecToInternal( bindResponse.getLdapResult(), internalMessage.getLdapResult() ); return internalMessage; }
/** * Transform a Internal BindResponse to a Codec BindResponse * * @param internalMessage The incoming Internal BindResponse * @return The BindResponseCodec instance */ private static LdapMessageCodec transformBindResponse( InternalMessage internalMessage ) { BindResponseImpl internalBindResponse = ( BindResponseImpl ) internalMessage; BindResponseCodec bindResponseCodec = new BindResponseCodec(); // Internal : byte [] serverSaslCreds -> Codec : OctetString // serverSaslCreds byte[] serverSaslCreds = internalBindResponse.getServerSaslCreds(); if ( serverSaslCreds != null ) { bindResponseCodec.setServerSaslCreds( serverSaslCreds ); } // Transform the ldapResult bindResponseCodec.setLdapResult( transformLdapResult( ( LdapResultImpl ) internalBindResponse.getLdapResult() ) ); return bindResponseCodec; }
/** * The result containing response for this request. * * @return the result containing response for this request */ public InternalResultResponse getResultResponse() { if ( response == null ) { response = new BindResponseImpl( getMessageId() ); } return response; }
public void action( IAsn1Container container ) throws DecoderException { LdapMessageContainer ldapMessageContainer = ( LdapMessageContainer ) container; BindRequestCodec bindRequestMessage = ldapMessageContainer.getBindRequest(); TLV tlv = ldapMessageContainer.getCurrentTLV(); // We will check that the sasl is not null if ( tlv.getLength() == 0 ) { String msg = I18n.err( I18n.ERR_04079 ); log.error( msg ); BindResponseImpl response = new BindResponseImpl( bindRequestMessage.getMessageId() ); throw new ResponseCarryingException( msg, response, ResultCodeEnum.INVALID_CREDENTIALS, bindRequestMessage.getName(), null ); } // Create the SaslCredentials Object SaslCredentials authentication = new SaslCredentials(); authentication.setParent( bindRequestMessage ); bindRequestMessage.setAuthentication( authentication ); if ( IS_DEBUG ) { log.debug( "The SaslCredential has been created" ); } return; } } );
log.error( "{} : {}", msg, ine.getMessage() ); BindResponseImpl response = new BindResponseImpl( bindRequestMessage.getMessageId() );