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

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


        _principal.set(principal);
    }

    public static void setThreadPrincipal(String authId)
    {
        setThreadPrincipal(new UsernamePrincipal(authId));
    }
View Full Code Here


        super(ApplicationRegistry.getInstance().getVirtualHostRegistry(), new TestNetworkConnection(), ID_GENERATOR.getAndIncrement());

        _channelDelivers = new HashMap<Integer, Map<AMQShortString, LinkedList<DeliveryPair>>>();

        // Need to authenticate session for it to be representative testing.
        setAuthorizedSubject(new Subject(true, Collections.singleton(new UsernamePrincipal("InternalTestProtocolSession")),
                Collections.EMPTY_SET, Collections.EMPTY_SET));

        setVirtualHost(virtualHost);
    }
View Full Code Here

    {
        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

    public void testNonSaslAuthenticationSuccess() throws Exception
    {
        AuthenticationResult result = _manager.authenticate("guest", "guest");
        final Subject subject = result.getSubject();
        assertFalse("Subject should not be set read-only", subject.isReadOnly());
        assertTrue(subject.getPrincipals().contains(new UsernamePrincipal("guest")));
        assertEquals(AuthenticationStatus.SUCCESS, result.getStatus());
    }
View Full Code Here

        try {
            UserRealm userRealm = getUserRealm(username);

            if ((null != userRealm) && userRealm.getUserStoreManager().isExistingUser(username)) {
                user = new UsernamePrincipal(username);
            }
        } catch (Exception e) {
            logger.error("Error while retrieving RegistryService : " + e.getMessage());
        }
View Full Code Here

    public boolean setPassword(String username, char[] password)
    {
        try
        {
            //delegate password changes to the Principal Database
            return _principalDatabase.updatePassword(new UsernamePrincipal(username), password);
        }
        catch (AccountNotFoundException e)
        {
            _logger.warn("Attempt to set password of non-existant user'" + username + "'");
            return false;
View Full Code Here

        return true;
    }

    public boolean createUser(String username, char[] password, boolean read, boolean write, boolean admin)
    {
        if (_principalDatabase.createPrincipal(new UsernamePrincipal(username), password))
        {
            if (!setRights(username, read, write, admin))
            {
                //unable to set rights for user, remove account
                try
                {
                    _principalDatabase.deletePrincipal(new UsernamePrincipal(username));
                }
                catch (AccountNotFoundException e)
                {
                    //ignore
                }
View Full Code Here

    public boolean deleteUser(String username)
    {
        try
        {
            if (_principalDatabase.deletePrincipal(new UsernamePrincipal(username)))
            {
                try
                {
                    _accessRightsUpdate.lock();
View Full Code Here

    public Principal getUser(String username)
    {
        if (_users.containsKey(username))
        {
            return new UsernamePrincipal(username);
        }
        return null;
    }
View Full Code Here

    public Principal getUser(String username)
    {
        if (_users.containsKey(username))
        {
            return new UsernamePrincipal(username);
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of org.apache.qpid.server.security.auth.sasl.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.