Package javax.security.sasl

Examples of javax.security.sasl.SaslServer


            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


            // 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

            return;
        }

        try
        {
            SaslServer ss = Sasl.createSaslServer
                (mechanism, "AMQP", "localhost", null, null);
            if (ss == null)
            {
                conn.connectionClose
                    (ConnectionCloseCode.CONNECTION_FORCED,
View Full Code Here

        }
    }

    private void secure(Connection conn, byte[] response)
    {
        SaslServer ss = conn.getSaslServer();
        try
        {
            byte[] challenge = ss.evaluateResponse(response);
            if (ss.isComplete())
            {
                ss.dispose();
                conn.connectionTune
                    (Integer.MAX_VALUE,
                     org.apache.qpid.transport.network.ConnectionBinding.MAX_FRAME_SIZE,
                     0, Integer.MAX_VALUE);
            }
View Full Code Here

     * Tests that the SASL factory method createSaslServer correctly
     * returns a non-null implementation.
     */
    public void testSaslMechanismCreation() throws Exception
    {
        SaslServer server = _manager.createSaslServer("CRAM-MD5", "localhost");
        assertNotNull(server);
        // Merely tests the creation of the mechanism. Mechanisms themselves are tested
        // by their own tests.
    }
View Full Code Here

     * authentication success.
     *
     */
    public void testSaslAuthenticationSuccess() throws Exception
    {
        SaslServer testServer = createTestSaslServer(true, false);
       
        AuthenticationResult result = _manager.authenticate(testServer, "12345".getBytes());
        final Subject subject = result.getSubject();
        assertTrue(subject.getPrincipals().contains(new UsernamePrincipal("guest")));
        assertEquals(AuthenticationStatus.SUCCESS, result.getStatus());
View Full Code Here

     * authentication not complete.
     *
     */
    public void testSaslAuthenticationNotCompleted() throws Exception
    {
        SaslServer testServer = createTestSaslServer(false, false);
       
        AuthenticationResult result = _manager.authenticate(testServer, "12345".getBytes());
        assertNull(result.getSubject());
        assertEquals(AuthenticationStatus.CONTINUE, result.getStatus());
    }
View Full Code Here

     * authentication error.
     *
     */
    public void testSaslAuthenticationError() throws Exception
    {
        SaslServer testServer = createTestSaslServer(false, true);
       
        AuthenticationResult result = _manager.authenticate(testServer, "12345".getBytes());
        assertNull(result.getSubject());
        assertEquals(AuthenticationStatus.ERROR, result.getStatus());
    }
View Full Code Here

    /**
     * Test SASL implementation used to test the authenticate() method.
     */
    private SaslServer createTestSaslServer(final boolean complete, final boolean throwSaslException)
    {
        return new SaslServer()
        {
            public String getMechanismName()
            {
                return null;
            }
View Full Code Here

            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

TOP

Related Classes of javax.security.sasl.SaslServer

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.