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

Examples of org.apache.qpid.server.security.auth.manager.AuthenticationManager


        verify(am).onCreate();
    }

    public void testCreateNonPasswordCredentialManagingAuthenticationProvider()
    {
        AuthenticationManager am = mock(AuthenticationManager.class);
        AuthenticationProvider provider = testForFactory(am, true);
        assertFalse("The created provider should match the factory's AuthenticationManager type",
                provider instanceof PasswordCredentialManagingAuthenticationProvider);
        verify(am).onCreate();
    }
View Full Code Here


        verify(am).onCreate();
    }

    public void testRecoverPasswordCredentialManagingAuthenticationProvider()
    {
        AuthenticationManager am = mock(PrincipalDatabaseAuthenticationManager.class);
        AuthenticationProvider provider = testForFactory(am, false);
        assertTrue("The created provider should match the factory's AuthenticationManager type",
                provider instanceof PasswordCredentialManagingAuthenticationProvider);
        verify(am, never()).onCreate();
    }
View Full Code Here

        verify(am, never()).onCreate();
    }

    public void testRecoverNonPasswordCredentialManagingAuthenticationProvider()
    {
        AuthenticationManager am = mock(AuthenticationManager.class);
        AuthenticationProvider provider = testForFactory(am, false);
        assertFalse("The created provider should match the factory's AuthenticationManager type",
                provider instanceof PasswordCredentialManagingAuthenticationProvider);
        verify(am, never()).onCreate();
    }
View Full Code Here

    public void methodReceived(AMQStateManager stateManager, ConnectionSecureOkBody body, int channelId) throws AMQException
    {
        AMQProtocolSession session = stateManager.getProtocolSession();

        AuthenticationManager authMgr = ApplicationRegistry.getInstance().getAuthenticationManager();

        SaslServer ss = session.getSaslServer();
        if (ss == null)
        {
            throw new AMQException("No SASL context set up in session");
        }
        MethodRegistry methodRegistry = session.getMethodRegistry();
        AuthenticationResult authResult = authMgr.authenticate(ss, body.getResponse());
        switch (authResult.getStatus())
        {
            case ERROR:
                Exception cause = authResult.getCause();
View Full Code Here

        AMQProtocolSession session = stateManager.getProtocolSession();
       
        _logger.info("SASL Mechanism selected: " + body.getMechanism());
        _logger.info("Locale selected: " + body.getLocale());

        AuthenticationManager authMgr = ApplicationRegistry.getInstance().getAuthenticationManager();

        SaslServer ss = null;
        try
        {                      
            ss = authMgr.createSaslServer(String.valueOf(body.getMechanism()), session.getLocalFQDN());

            if (ss == null)
            {
                throw body.getConnectionException(AMQConstant.RESOURCE_ERROR, "Unable to create SASL Server:" + body.getMechanism());
            }

            session.setSaslServer(ss);

            AuthenticationResult authResult = authMgr.authenticate(ss, body.getResponse());

            //save clientProperties
            if (session.getClientProperties() == null)
            {
                session.setClientProperties(body.getClientProperties());
View Full Code Here

        }
    }

    private AuthenticationManager createTestAuthenticationManager(final boolean successfulAuth, final Exception exception)
    {
        return new AuthenticationManager()
        {
            public void configure(ConfigurationPlugin config)
            {
                throw new UnsupportedOperationException();
            }
View Full Code Here

        users.put("guest","guest");
        users.put("admin","admin");

        final PropertiesPrincipalDatabase ppd = new PropertiesPrincipalDatabase(users);

        final AuthenticationManager pdam =  new PrincipalDatabaseAuthenticationManager()
        {

            /**
             * @see org.apache.qpid.server.security.auth.manager.PrincipalDatabaseAuthenticationManager#configure(org.apache.qpid.server.configuration.plugins.ConfigurationPlugin)
             */
            @Override
            public void configure(ConfigurationPlugin config) throws ConfigurationException
            {
                // We don't pass configuration to this test instance.
            }

            @Override
            public void initialise()
            {
                setPrincipalDatabase(ppd);

                super.initialise();
            }
        };
        pdam.initialise();

        return new IAuthenticationManagerRegistry()
        {
            @Override
            public void close()
            {
                pdam.close();
            }

            @Override
            public AuthenticationManager getAuthenticationManager(
                    SocketAddress address)
            {
                return pdam;
            }

            @Override
            public Map<String, AuthenticationManager> getAvailableAuthenticationManagers()
            {
                return Collections.singletonMap(pdam.getClass().getName(), pdam);
            }

            @Override
            public void addRegistryChangeListener(RegistryChangeListener listener)
            {
View Full Code Here

        _supportedVirtualHostStoreTypes = new MessageStoreCreator().getStoreTypes();
        _supportedBrokerStoreTypes = new BrokerConfigurationStoreCreator().getStoreTypes();
        _brokerStore = brokerStore;
        if (_brokerOptions.isManagementMode())
        {
            AuthenticationManager authManager = new SimpleAuthenticationManager(BrokerOptions.MANAGEMENT_MODE_USER_NAME, _brokerOptions.getManagementModePassword());
            AuthenticationProvider authenticationProvider = new SimpleAuthenticationProviderAdapter(UUID.randomUUID(), this,
                    authManager, Collections.<String, Object> emptyMap(), Collections.<String> emptySet());
            _managementAuthenticationProvider = authenticationProvider;
        }
    }
View Full Code Here

        }
    }

    private AuthenticationManager createTestAuthenticationManager(final boolean successfulAuth, final Exception exception)
    {
        return new AuthenticationManager()
        {
            public void configure(ConfigurationPlugin config)
            {
                throw new UnsupportedOperationException();
            }
View Full Code Here

        users.put("guest","guest");
        users.put("admin","admin");

        final PropertiesPrincipalDatabase ppd = new PropertiesPrincipalDatabase(users);

        AuthenticationManager pdam =  new PrincipalDatabaseAuthenticationManager()
        {

            /**
             * @see org.apache.qpid.server.security.auth.manager.PrincipalDatabaseAuthenticationManager#configure(org.apache.qpid.server.configuration.plugins.ConfigurationPlugin)
             */
            @Override
            public void configure(ConfigurationPlugin config) throws ConfigurationException
            {
                // We don't pass configuration to this test instance.
            }

            @Override
            public void initialise()
            {
                setPrincipalDatabase(ppd);

                super.initialise();
            }
        };

        pdam.initialise();

        return pdam;
    }
View Full Code Here

TOP

Related Classes of org.apache.qpid.server.security.auth.manager.AuthenticationManager

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.