Package org.apache.qpid.server.security.auth

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


        {
            AuthenticationResult result = doLDAPNameAuthentication(getNameFromId(username), password);
            if(result.getStatus() == AuthenticationStatus.SUCCESS)
            {
                //Return a result based on the supplied username rather than the search name
                return new AuthenticationResult(new UsernamePrincipal(username));
            }
            else
            {
                return result;
            }
View Full Code Here


        try
        {
            ctx = new InitialDirContext(env);

            //Authentication succeeded
            return new AuthenticationResult(new UsernamePrincipal(name));
        }
        catch(AuthenticationException ae)
        {
            //Authentication failed
            return new AuthenticationResult(AuthenticationStatus.CONTINUE);
View Full Code Here

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

        if (_users.containsKey(username))
        {
            String userPassword = _users.get(username);
            if (userPassword.equals(password))
            {
                return new AuthenticationResult(new UsernamePrincipal(username));
            }
        }
        return new AuthenticationResult(AuthenticationResult.AuthenticationStatus.ERROR);
    }
View Full Code Here

            byte[] challenge = server.evaluateResponse(response != null ? response : new byte[0]);

            if (server.isComplete())
            {
                final String userId = server.getAuthorizationID();
                return new AuthenticationResult(new UsernamePrincipal(userId));
            }
            else
            {
                return new AuthenticationResult(challenge, AuthenticationResult.AuthenticationStatus.CONTINUE);
            }
View Full Code Here

    {
        try
        {
            if (_principalDatabase.verifyPassword(username, password.toCharArray()))
            {
                return new AuthenticationResult(new UsernamePrincipal(username));
            }
            else
            {
                return new AuthenticationResult(AuthenticationStatus.CONTINUE);
            }
View Full Code Here

    {
        Subject subjectWithNoPrincipals = new Subject();
        assertNull(AuthenticatedPrincipal.getOptionalAuthenticatedPrincipalFromSubject(subjectWithNoPrincipals));

        Subject subjectWithoutAuthenticatedPrincipal = new Subject();
        subjectWithoutAuthenticatedPrincipal.getPrincipals().add(new UsernamePrincipal("name1"));
        assertNull("Should return null for a subject containing a principal that isn't an AuthenticatedPrincipal",
                AuthenticatedPrincipal.getOptionalAuthenticatedPrincipalFromSubject(subjectWithoutAuthenticatedPrincipal));
    }
View Full Code Here

    }

    public void testTooManyAuthenticatedPrincipalsInSubject()
    {
        final Subject subject = new Subject();
        subject.getPrincipals().add(new AuthenticatedPrincipal(new UsernamePrincipal("name1")));
        subject.getPrincipals().add(new AuthenticatedPrincipal(new UsernamePrincipal("name2")));

        try
        {
            AuthenticatedPrincipal.getAuthenticatedPrincipalFromSubject(subject);
            fail("Exception not thrown");
View Full Code Here

        return subject;
    }

    public void testEqualsAndHashcode()
    {
        AuthenticatedPrincipal user1principal1 = new AuthenticatedPrincipal(new UsernamePrincipal("user1"));
        AuthenticatedPrincipal user1principal2 = new AuthenticatedPrincipal(new UsernamePrincipal("user1"));

        assertTrue(user1principal1.equals(user1principal1));
        assertTrue(user1principal1.equals(user1principal2));
        assertTrue(user1principal2.equals(user1principal1));
View Full Code Here

        assertEquals(user1principal1.hashCode(), user1principal2.hashCode());
    }

    public void testEqualsAndHashcodeWithSameWrappedObject()
    {
        UsernamePrincipal wrappedPrincipal = new UsernamePrincipal("user1");
        AuthenticatedPrincipal user1principal1 = new AuthenticatedPrincipal(wrappedPrincipal);
        AuthenticatedPrincipal user1principal2 = new AuthenticatedPrincipal(wrappedPrincipal);

        assertTrue(user1principal1.equals(user1principal1));
        assertTrue(user1principal1.equals(user1principal2));
View Full Code Here

TOP

Related Classes of org.apache.qpid.server.security.auth.UsernamePrincipal

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.