Examples of AuthenticationResult


Examples of org.apache.qpid.server.security.auth.AuthenticationResult

    public void testAuthenticatePrincipalEmptyCn_CausesAuthError() throws Exception
    {
        X500Principal principal = new X500Principal("CN=, DC=example, DC=com, O=My Company Ltd, L=Newbury, ST=Berkshire, C=GB");
        SaslServer saslServer = _manager.createSaslServer("EXTERNAL", "example.example.com", principal);
        AuthenticationResult result = _manager.authenticate(saslServer, new byte[0]);

        assertNotNull(result);
        assertEquals("Expected authentication to be unsuccessful",
                AuthenticationResult.AuthenticationStatus.ERROR,
                result.getStatus());
        assertNull(saslServer.getAuthorizationID());
    }
View Full Code Here

Examples of org.apache.qpid.server.security.auth.AuthenticationResult

    {
        X500Principal principal = new X500Principal("CN=person");
        UsernamePrincipal expectedPrincipal = new UsernamePrincipal("person");
        SaslServer saslServer = _manager.createSaslServer("EXTERNAL", "example.example.com", principal);

        AuthenticationResult result = _manager.authenticate(saslServer, new byte[0]);
        assertNotNull(result);
        assertEquals("Expected authentication to be successful",
                     AuthenticationResult.AuthenticationStatus.SUCCESS,
                     result.getStatus());
        assertOnlyContainsWrapped(expectedPrincipal, result.getPrincipals());
        assertEquals("person", saslServer.getAuthorizationID());
    }
View Full Code Here

Examples of org.apache.qpid.server.security.auth.AuthenticationResult

    {
        X500Principal principal = new X500Principal("CN=person, DC=example, DC=com");
        UsernamePrincipal expectedPrincipal = new UsernamePrincipal("person@example.com");
        SaslServer saslServer = _manager.createSaslServer("EXTERNAL", "example.example.com", principal);

        AuthenticationResult result = _manager.authenticate(saslServer, new byte[0]);
        assertNotNull(result);
        assertEquals("Expected authentication to be successful",
                AuthenticationResult.AuthenticationStatus.SUCCESS,
                result.getStatus());
        assertOnlyContainsWrapped(expectedPrincipal, result.getPrincipals());
        assertEquals("person@example.com", saslServer.getAuthorizationID());
    }
View Full Code Here

Examples of org.apache.qpid.server.security.auth.AuthenticationResult

    {
        X500Principal principal = new X500Principal("CN=person, DC=example, DC=com, O=My Company Ltd, L=Newbury, ST=Berkshire, C=GB");
        UsernamePrincipal expectedPrincipal = new UsernamePrincipal("person@example.com");
        SaslServer saslServer = _manager.createSaslServer("EXTERNAL", "example.example.com", principal);

        AuthenticationResult result = _manager.authenticate(saslServer, new byte[0]);
        assertNotNull(result);
        assertEquals("Expected authentication to be successful",
                AuthenticationResult.AuthenticationStatus.SUCCESS,
                result.getStatus());
        assertOnlyContainsWrapped(expectedPrincipal, result.getPrincipals());
        assertEquals("person@example.com", saslServer.getAuthorizationID());
    }
View Full Code Here

Examples of org.apache.qpid.server.security.auth.AuthenticationResult

    {
        X500Principal principal = new X500Principal("CN=person, O=My Company Ltd, L=Newbury, ST=Berkshire, C=GB");
        UsernamePrincipal expectedPrincipal = new UsernamePrincipal("person");
        SaslServer saslServer = _manager.createSaslServer("EXTERNAL", "example.example.com", principal);

        AuthenticationResult result = _manager.authenticate(saslServer, new byte[0]);
        assertNotNull(result);
        assertEquals("Expected authentication to be successful",
                AuthenticationResult.AuthenticationStatus.SUCCESS,
                result.getStatus());
        assertOnlyContainsWrapped(expectedPrincipal, result.getPrincipals());
        assertEquals("person", saslServer.getAuthorizationID());
    }
View Full Code Here

Examples of org.apache.qpid.server.security.auth.AuthenticationResult

    public void testFullDNMode_Authenticate() throws Exception
    {
        X500Principal principal = new X500Principal("CN=person, DC=example, DC=com");
        SaslServer saslServer = _managerUsingFullDN.createSaslServer("EXTERNAL", "example.example.com", principal);

        AuthenticationResult result = _managerUsingFullDN.authenticate(saslServer, new byte[0]);
        assertNotNull(result);
        assertEquals("Expected authentication to be successful",
                     AuthenticationResult.AuthenticationStatus.SUCCESS,
                     result.getStatus());

        assertOnlyContainsWrapped(principal, result.getPrincipals());
        assertEquals("CN=person,DC=example,DC=com", saslServer.getAuthorizationID());
    }
View Full Code Here

Examples of org.apache.qpid.server.security.auth.AuthenticationResult

    }

    public void testFullDNMode_AuthenticatePrincipalNull_CausesAuthError() throws Exception
    {
        SaslServer saslServer = _managerUsingFullDN.createSaslServer("EXTERNAL", "example.example.com", null);
        AuthenticationResult result = _managerUsingFullDN.authenticate(saslServer, new byte[0]);

        assertNotNull(result);
        assertEquals("Expected authentication to be unsuccessful",
                     AuthenticationResult.AuthenticationStatus.ERROR,
                     result.getStatus());
        assertNull(saslServer.getAuthorizationID());
    }
View Full Code Here

Examples of org.apache.qpid.server.security.auth.AuthenticationResult

     * @param server SASL server
     * @param response SASL response to process
     */
    public SubjectAuthenticationResult authenticate(SaslServer server, byte[] response)
    {
        AuthenticationResult authenticationResult = _authenticationManager.authenticate(server, response);
        if(server.isComplete())
        {
            String username = server.getAuthorizationID();

            return createResultWithGroups(username, authenticationResult);
View Full Code Here

Examples of org.apache.qpid.server.security.auth.AuthenticationResult

    /**
     * Authenticates a user using their username and password.
     */
    public SubjectAuthenticationResult authenticate(String username, String password)
    {
        final AuthenticationResult authenticationResult = _authenticationManager.authenticate(username, password);

        return createResultWithGroups(username, authenticationResult);
    }
View Full Code Here

Examples of org.apache.qpid.server.security.auth.AuthenticationResult

            if (server.isComplete())
            {
                String authorizationID = server.getAuthorizationID();
                _logger.debug("Authenticated as " + authorizationID);

                return new AuthenticationResult(new UsernamePrincipal(authorizationID));
            }
            else
            {
                return new AuthenticationResult(challenge, AuthenticationResult.AuthenticationStatus.CONTINUE);
            }
        }
        catch (SaslException e)
        {
            return new AuthenticationResult(AuthenticationResult.AuthenticationStatus.ERROR, e);
        }
    }
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.