Package org.apache.directory.api.ldap.model.message

Examples of org.apache.directory.api.ldap.model.message.ExtendedRequest


        // and degrade authentication level to 'anonymous' as specified
        // in the RFC, and this is no threat.

        if ( message == SslFilter.SESSION_SECURED )
        {
            ExtendedRequest req =
                LdapApiServiceFactory.getSingleton().newExtendedRequest( "1.3.6.1.4.1.1466.20037",
                    "SECURED".getBytes( "ISO-8859-1" ) );
            message = req;
        }
        else if ( message == SslFilter.SESSION_UNSECURED )
        {
            ExtendedRequest req =
                LdapApiServiceFactory.getSingleton().newExtendedRequest( "1.3.6.1.4.1.1466.20037",
                    "SECURED".getBytes( "ISO-8859-1" ) );
            message = req;
        }

        if ( ( ( Request ) message ).getControls().size() > 0
            && message instanceof ResultResponseRequest )
        {
            ResultResponseRequest req = ( ResultResponseRequest ) message;

            for ( Control control : req.getControls().values() )
            {
                if ( control.isCritical() && !ldapServer.getSupportedControls().contains( control.getOid() ) )
                {
                    ResultResponse resp = req.getResultResponse();
                    resp.getLdapResult().setDiagnosticMessage( "Unsupport critical control: " + control.getOid() );
                    resp.getLdapResult().setResultCode( ResultCodeEnum.UNAVAILABLE_CRITICAL_EXTENSION );
                    session.write( resp );

                    return;
View Full Code Here


        if ( !isConfidentialityRequirementSatisfied( session ) )
        {
            if ( message instanceof ExtendedRequest )
            {
                // Reject all extended operations except StartTls 
                ExtendedRequest req = ( ExtendedRequest ) message;

                if ( !req.getRequestName().equals( StartTlsHandler.EXTENSION_OID ) )
                {
                    rejectWithoutConfidentiality( session, req.getResultResponse() );
                    return;
                }

                // Allow StartTls extended operations to go through
            }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public ExtendedResponse extended( Oid oid, byte[] value ) throws LdapException
    {
        ExtendedRequest extendedRequest =
            LdapApiServiceFactory.getSingleton().newExtendedRequest( oid.toString(), value );
        return extended( extendedRequest );
    }
View Full Code Here

    @Test
    public void testExtendedAsync() throws Exception
    {
        try
        {
            ExtendedRequest extendedRequest = new StartTlsRequestImpl();
            extendedRequest.setRequestName( StartTlsRequest.OID );

            ExtendedFuture extendedFuture = connection.extendedAsync( extendedRequest );

            ExtendedResponse extendedResponse = ( ExtendedResponse ) extendedFuture.get( 1000, TimeUnit.MILLISECONDS );
View Full Code Here

    @Test
    public void testExtendedAsync() throws Exception
    {
        try
        {
            ExtendedRequest extendedRequest = new ExtendedRequestImpl();
            extendedRequest.setRequestName( StartTlsRequest.OID );

            ExtendedFuture extendedFuture = connection.extendedAsync( extendedRequest );

            ExtendedResponse extendedResponse = ( ExtendedResponse ) extendedFuture.get( 1000, TimeUnit.MILLISECONDS );
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public ExtendedResponse extended( Oid oid, byte[] value ) throws LdapException
    {
        ExtendedRequest extendedRequest =
            LdapApiServiceFactory.getSingleton().newExtendedRequest( oid.toString(), value );
        return extended( extendedRequest );
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public ExtendedRequest newExtendedRequest( String oid, byte[] value )
    {
        ExtendedRequest req = null;

        ExtendedOperationFactory extendedRequestFactory = extendedOperationsFactories.get( oid );

        if ( extendedRequestFactory != null )
        {
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public void action( LdapMessageContainer<ExtendedRequestDecorator<?>> container ) throws DecoderException
    {
        ExtendedRequest req;

        // Get the Value and store it in the ExtendedRequest
        TLV tlv = container.getCurrentTLV();

        // We have to handle the special case of a 0 length matched
        // OID
        if ( tlv.getLength() == 0 )
        {
            String msg = I18n.err( I18n.ERR_04095 );
            LOG.error( msg );
            // This will generate a PROTOCOL_ERROR
            throw new DecoderException( msg );
        }
        else
        {
            byte[] requestNameBytes = tlv.getValue().getData();

            try
            {
                String requestName = Strings.utf8ToString( requestNameBytes );

                if ( !Oid.isOid( requestName ) )
                {

                    String msg = "The Request name is not a valid OID : "
                        + Strings.utf8ToString( requestNameBytes ) + " ("
                        + Strings.dumpBytes( requestNameBytes ) + ") is invalid";
                    LOG.error( msg );

                    // throw an exception, we will get a PROTOCOL_ERROR
                    throw new DecoderException( msg );
                }

                req = LdapApiServiceFactory.getSingleton().newExtendedRequest( requestName, null );
                req.setMessageId( container.getMessageId() );
                container.setMessage( LdapApiServiceFactory.getSingleton().decorate( req ) );
            }
            catch ( DecoderException de )
            {
                String msg = "The Request name is not a valid OID : "
                    + Strings.utf8ToString( requestNameBytes ) + " ("
                    + Strings.dumpBytes( requestNameBytes ) + ") is invalid";
                LOG.error( "{} : {}", msg, de.getMessage() );

                // Rethrow the exception, we will get a PROTOCOL_ERROR
                throw de;
            }
        }

        // We can have an END transition
        container.setGrammarEndAllowed( true );

        if ( IS_DEBUG )
        {
            LOG.debug( "OID read : {}", req.getRequestName() );
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.directory.api.ldap.model.message.ExtendedRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.