Examples of MechanismHandler


Examples of org.apache.directory.server.ldap.handlers.bind.MechanismHandler

                // Mark the user as authenticated
                ldapSession.setAuthenticated();

                // Call the cleanup method for the selected mechanism
                MechanismHandler handler = ( MechanismHandler ) ldapSession
                    .getSaslProperty( SaslConstants.SASL_MECH_HANDLER );
                handler.cleanup( ldapSession );

                // Return the successful response
                sendBindSuccess( ldapSession, bindRequest, tokenBytes );
            }
            else
View Full Code Here

Examples of org.apache.directory.server.ldap.handlers.bind.MechanismHandler

            // 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 );
View Full Code Here

Examples of org.apache.directory.server.ldap.handlers.bind.MechanismHandler

            return;
        }

        // We have already received a first BindRequest, and sent back some challenge.
        // First, check if the mechanism is the same
        MechanismHandler mechanismHandler = handlers.get( saslMechanism );

        if ( mechanismHandler == null )
        {
            String message = I18n.err( I18n.ERR_161, saslMechanism );

            // Clear the saslProperties, and move to the anonymous state
            ldapSession.clearSaslProperties();
            ldapSession.setAnonymous();

            LOG.error( message );
            throw new IllegalArgumentException( message );
        }

        // Get the previously created SaslServer instance
        SaslServer ss = mechanismHandler.handleMechanism( ldapSession, bindRequest );

        generateSaslChallengeOrComplete( ldapSession, ss, bindRequest );
    }
View Full Code Here

Examples of org.apache.directory.server.ldap.handlers.bind.MechanismHandler

                // Store the mechanism in the ldap session
                ldapSession.putSaslProperty( SaslConstants.SASL_MECH, saslMechanism );

                // Get the handler for this mechanism
                MechanismHandler mechanismHandler = handlers.get( saslMechanism );

                // Store the mechanism handler in the salsProperties
                ldapSession.putSaslProperty( SaslConstants.SASL_MECH_HANDLER, mechanismHandler );

                // Initialize the mechanism specific data
                mechanismHandler.init( ldapSession );

                // Get the SaslServer instance which manage the C/R exchange
                SaslServer ss = mechanismHandler.handleMechanism( ldapSession, bindRequest );

                // We have to generate a challenge
                generateSaslChallengeOrComplete( ldapSession, ss, bindRequest );

                // And get back
View Full Code Here

Examples of org.apache.directory.server.ldap.handlers.bind.MechanismHandler

    @Test
    public void testSetSaslMechanismHandlers()
    {
        LdapServer server = new LdapServer();
        Map<String, MechanismHandler> handlers = new HashMap<String,MechanismHandler>();
        MechanismHandler handler = new PlainMechanismHandler();
        handlers.put( SupportedSaslMechanisms.PLAIN, handler );
        server.setSaslMechanismHandlers( handlers );
        assertEquals( handler, server.getMechanismHandler( SupportedSaslMechanisms.PLAIN ) );
        assertTrue( server.getSupportedMechanisms().contains( SupportedSaslMechanisms.PLAIN ) );
        server.removeSaslMechanismHandler( SupportedSaslMechanisms.PLAIN );
View Full Code Here

Examples of org.apache.directory.server.ldap.handlers.bind.MechanismHandler

           
            for( SaslMechanism saslMech : createLdapServer.saslMechanisms() )
            {
                try
                {
                    MechanismHandler handler = ( MechanismHandler ) saslMech.implClass().newInstance();
                    ldapServer.addSaslMechanismHandler( saslMech.name(), handler );
                }
                catch( Exception e )
                {
                    throw new RuntimeException( I18n.err( I18n.ERR_691, saslMech.name(), saslMech.implClass().getName() ), e );
View Full Code Here

Examples of org.apache.directory.server.ldap.handlers.bind.MechanismHandler

            String message = "Cannot find the class " + mechClassName;
            LOG.error( message );
            throw new ConfigurationException( message );
        }
       
        MechanismHandler handler = null;
       
        try
        {
            handler = ( MechanismHandler ) mechClass.newInstance();
        }
View Full Code Here

Examples of org.apache.directory.server.ldap.handlers.bind.MechanismHandler

           
            for( SaslMechanism saslMech : createLdapServer.saslMechanisms() )
            {
                try
                {
                    MechanismHandler handler = ( MechanismHandler ) saslMech.implClass().newInstance();
                    ldapServer.addSaslMechanismHandler( saslMech.name(), handler );
                }
                catch( Exception e )
                {
                    throw new RuntimeException( I18n.err( I18n.ERR_691, saslMech.name(), saslMech.implClass().getName() ), e );
View Full Code Here

Examples of org.apache.directory.server.ldap.handlers.bind.MechanismHandler

                // Mark the user as authenticated
                ldapSession.setAuthenticated();

                // Call the cleanup method for the selected mechanism
                MechanismHandler handler = ( MechanismHandler ) ldapSession
                    .getSaslProperty( SaslConstants.SASL_MECH_HANDLER );
                handler.cleanup( ldapSession );

                // Return the successful response
                sendBindSuccess( ldapSession, bindRequest, tokenBytes );
            }
            else
View Full Code Here

Examples of org.apache.directory.server.ldap.handlers.bind.MechanismHandler

            // 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 );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.