Package org.apache.qpid.server.plugin

Examples of org.apache.qpid.server.plugin.AuthenticationManagerFactory


        String currentType = (String)getAttribute(AuthenticationManagerFactory.ATTRIBUTE_TYPE);
        if (!currentType.equals(newType))
        {
            throw new IllegalConfigurationException("Changing the type of authentication provider is not supported");
        }
        AuthenticationManagerFactory managerFactory = _factories.get(newType);
        if (managerFactory == null)
        {
            throw new IllegalConfigurationException("Cannot find authentication provider factory for type " + newType);
        }
        AuthenticationManager manager = managerFactory.createInstance(_broker, attributes);
        if (manager == null)
        {
            throw new IllegalConfigurationException("Cannot change authentication provider " + newName + " of type " + newType + " with the given attributes");
        }
        return manager;
View Full Code Here


    {
        UUID id = UUID.randomUUID();
        Map<String, Object> attributes = new HashMap<String, Object>();

        QpidServiceLoader<AuthenticationManagerFactory> authManagerFactoryServiceLoader = mock(QpidServiceLoader.class);
        AuthenticationManagerFactory authenticationManagerFactory = mock(AuthenticationManagerFactory.class);

        Broker broker = mock(Broker.class);

        when(authManagerFactoryServiceLoader.atLeastOneInstanceOf(AuthenticationManagerFactory.class)).thenReturn(
                Collections.singleton(authenticationManagerFactory));
        when(authenticationManagerFactory.createInstance(broker, attributes)).thenReturn(authenticationManager);

        AuthenticationProviderFactory providerFactory = new AuthenticationProviderFactory(authManagerFactoryServiceLoader);

        AuthenticationProvider provider = null;
        if (create)
View Full Code Here

        Broker broker = mock(Broker.class);
        PasswordCredentialManagingAuthenticationProvider anotherProvider = mock(PasswordCredentialManagingAuthenticationProvider.class);
        when(broker.getAuthenticationProviders()).thenReturn(Collections.<AuthenticationProvider>singleton(anotherProvider));

        QpidServiceLoader<AuthenticationManagerFactory> loader = mock(QpidServiceLoader.class);
        AuthenticationManagerFactory managerFactory = mock(AuthenticationManagerFactory.class);
        when(managerFactory.createInstance(any(Broker.class), any(Map.class))).thenReturn(mock(PrincipalDatabaseAuthenticationManager.class));
        when(loader.atLeastOneInstanceOf(AuthenticationManagerFactory.class)).thenReturn(Collections.singleton(managerFactory));

        AuthenticationProviderFactory providerFactory = new AuthenticationProviderFactory(loader);

        UUID randomUUID = UUID.randomUUID();
View Full Code Here

        Broker broker = mock(Broker.class);
        AuthenticationProvider anotherProvider = mock(AuthenticationProvider.class);
        when(broker.getAuthenticationProviders()).thenReturn(Collections.singleton(anotherProvider));

        QpidServiceLoader<AuthenticationManagerFactory> loader = mock(QpidServiceLoader.class);
        AuthenticationManagerFactory managerFactory = mock(AuthenticationManagerFactory.class);
        when(managerFactory.createInstance(any(Broker.class), any(Map.class))).thenReturn(mock(AuthenticationManager.class));
        when(loader.atLeastOneInstanceOf(AuthenticationManagerFactory.class)).thenReturn(Collections.singleton(managerFactory));

        AuthenticationProviderFactory providerFactory = new AuthenticationProviderFactory(loader);
        UUID id = UUID.randomUUID();
        AuthenticationProvider provider = providerFactory.create(id, broker, new HashMap<String, Object>());
View Full Code Here

        String currentType = (String)getAttribute(AuthenticationManagerFactory.ATTRIBUTE_TYPE);
        if (!currentType.equals(newType))
        {
            throw new IllegalConfigurationException("Changing the type of authentication provider is not supported");
        }
        AuthenticationManagerFactory managerFactory = _factories.get(newType);
        if (managerFactory == null)
        {
            throw new IllegalConfigurationException("Cannot find authentication provider factory for type " + newType);
        }
        AuthenticationManager manager = managerFactory.createInstance(attributes);
        if (manager == null)
        {
            throw new IllegalConfigurationException("Cannot change authentication provider " + newName + " of type " + newType + " with the given attributes");
        }
        return manager;
View Full Code Here

    {
        UUID id = UUID.randomUUID();
        Map<String, Object> attributes = new HashMap<String, Object>();

        QpidServiceLoader<AuthenticationManagerFactory> authManagerFactoryServiceLoader = mock(QpidServiceLoader.class);
        AuthenticationManagerFactory authenticationManagerFactory = mock(AuthenticationManagerFactory.class);

        Broker broker = mock(Broker.class);

        when(authManagerFactoryServiceLoader.atLeastOneInstanceOf(AuthenticationManagerFactory.class)).thenReturn(
                Collections.singleton(authenticationManagerFactory));
        when(authenticationManagerFactory.createInstance(attributes)).thenReturn(authenticationManager);

        AuthenticationProviderFactory providerFactory = new AuthenticationProviderFactory(authManagerFactoryServiceLoader);

        AuthenticationProvider provider = null;
        if (create)
View Full Code Here

        Broker broker = mock(Broker.class);
        PasswordCredentialManagingAuthenticationProvider anotherProvider = mock(PasswordCredentialManagingAuthenticationProvider.class);
        when(broker.getAuthenticationProviders()).thenReturn(Collections.<AuthenticationProvider>singleton(anotherProvider));

        QpidServiceLoader<AuthenticationManagerFactory> loader = mock(QpidServiceLoader.class);
        AuthenticationManagerFactory managerFactory = mock(AuthenticationManagerFactory.class);
        when(managerFactory.createInstance(any(Map.class))).thenReturn(mock(PrincipalDatabaseAuthenticationManager.class));
        when(loader.atLeastOneInstanceOf(AuthenticationManagerFactory.class)).thenReturn(Collections.singleton(managerFactory));

        AuthenticationProviderFactory providerFactory = new AuthenticationProviderFactory(loader);

        UUID randomUUID = UUID.randomUUID();
View Full Code Here

        Broker broker = mock(Broker.class);
        AuthenticationProvider anotherProvider = mock(AuthenticationProvider.class);
        when(broker.getAuthenticationProviders()).thenReturn(Collections.singleton(anotherProvider));

        QpidServiceLoader<AuthenticationManagerFactory> loader = mock(QpidServiceLoader.class);
        AuthenticationManagerFactory managerFactory = mock(AuthenticationManagerFactory.class);
        when(managerFactory.createInstance(any(Map.class))).thenReturn(mock(AuthenticationManager.class));
        when(loader.atLeastOneInstanceOf(AuthenticationManagerFactory.class)).thenReturn(Collections.singleton(managerFactory));

        AuthenticationProviderFactory providerFactory = new AuthenticationProviderFactory(loader);
        UUID id = UUID.randomUUID();
        AuthenticationProvider provider = providerFactory.create(id, broker, new HashMap<String, Object>());
View Full Code Here

    public Object perform(Map<String, Object> request, Broker broker)
    {
        Map<String, Object> attributes = new TreeMap<String, Object>();
        for (String providerType : _factories.keySet())
        {
            AuthenticationManagerFactory factory = _factories.get(providerType);

            Map<String, Object> data = new HashMap<String, Object>();
            data.put(ATTRIBUTES, factory.getAttributeNames());
            Map<String, String> resources = factory.getAttributeDescriptions();
            if (resources != null)
            {
                data.put(DESCRIPTIONS, resources);
            }

            attributes.put(factory.getType(), data);
        }
        return attributes;
    }
View Full Code Here

    }

    public void testAuthenticationManagersAreClosed() throws Exception
    {
        AuthenticationManager defaultAuthManager = mock(MockAuthenticationManager1.class);
        AuthenticationManagerFactory defaultAuthManagerFactory = newMockFactoryProducing(defaultAuthManager);

        AuthenticationManager authManager2 = mock(MockAuthenticationManager2.class);
        AuthenticationManagerFactory authManagerFactory2 = newMockFactoryProducing(authManager2);

        List<AuthenticationManagerFactory> factoryList = Arrays.asList(defaultAuthManagerFactory, authManagerFactory2);

        String defaultAuthMangerName = defaultAuthManager.getClass().getSimpleName();
        when(_serverConfiguration.getDefaultAuthenticationManager()).thenReturn(defaultAuthMangerName);
View Full Code Here

TOP

Related Classes of org.apache.qpid.server.plugin.AuthenticationManagerFactory

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.