Package org.apache.qpid.server.model

Examples of org.apache.qpid.server.model.AuthenticationProvider


    }

    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


                Collections.singleton(authenticationManagerFactory));
        when(authenticationManagerFactory.createInstance(attributes)).thenReturn(authenticationManager);

        AuthenticationProviderFactory providerFactory = new AuthenticationProviderFactory(authManagerFactoryServiceLoader);

        AuthenticationProvider provider = null;
        if (create)
        {
            provider = providerFactory.create(id, broker, attributes);
        }
        else
        {
            provider = providerFactory.recover(id, attributes, broker);
        }

        assertNotNull("Provider is not created", provider);
        assertEquals("Unexpected ID", id, provider.getId());

        return provider;
    }
View Full Code Here

        when(loader.atLeastOneInstanceOf(AuthenticationManagerFactory.class)).thenReturn(Collections.singleton(managerFactory));

        AuthenticationProviderFactory providerFactory = new AuthenticationProviderFactory(loader);

        UUID randomUUID = UUID.randomUUID();
        AuthenticationProvider provider = providerFactory.create(randomUUID, broker, new HashMap<String, Object>());

        assertNotNull("Provider is not created", provider);
        assertEquals("Unexpected ID", randomUUID, provider.getId());
    }
View Full Code Here

    @SuppressWarnings("unchecked")
    public void testCreateNonPasswordCredentialManagingAuthenticationProviderWhenAnotherOneAlreadyExist()
    {
        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>());

        assertNotNull("Provider is not created", provider);
        assertEquals("Unexpected ID", id, provider.getId());
    }
View Full Code Here

        String authenticationProviderName = (String)merged.get(AUTHENTICATION_PROVIDER);
        if (authenticationProviderName != null)
        {
            Collection<AuthenticationProvider> providers = _broker.getAuthenticationProviders();
            AuthenticationProvider provider = null;
            for (AuthenticationProvider p : providers)
            {
                if (p.getName().equals(authenticationProviderName))
                {
                    provider = p;
View Full Code Here

        _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

        return removedAccessControlProvider != null;
    }

    private AuthenticationProvider createAuthenticationProvider(Map<String, Object> attributes)
    {
        AuthenticationProvider authenticationProvider = _authenticationProviderFactory.create(UUID.randomUUID(), this, attributes);
        authenticationProvider.setDesiredState(State.INITIALISING, State.ACTIVE);
        addAuthenticationProvider(authenticationProvider);
        return authenticationProvider;
    }
View Full Code Here

        return removedPort != null;
    }

    private boolean deleteAuthenticationProvider(AuthenticationProvider authenticationProvider)
    {
        AuthenticationProvider removedAuthenticationProvider = null;
        synchronized (_authenticationProviders)
        {
            removedAuthenticationProvider = _authenticationProviders.remove(authenticationProvider.getId());
        }

        if(removedAuthenticationProvider != null)
        {
            removedAuthenticationProvider.removeChangeListener(this);
        }

        return removedAuthenticationProvider != null;
    }
View Full Code Here

    @Override
    public SubjectCreator getSubjectCreator(SocketAddress localAddress)
    {
        InetSocketAddress inetSocketAddress = (InetSocketAddress)localAddress;
        AuthenticationProvider provider = null;
        Collection<Port> ports = getPorts();
        for (Port p : ports)
        {
            if (inetSocketAddress.getPort() == p.getPort())
            {
                provider = p.getAuthenticationProvider();
                break;
            }
        }

        if(provider == null)
        {
            throw new IllegalConfigurationException("Unable to determine authentication provider for address: " + localAddress);
        }

        return provider.getSubjectCreator();
    }
View Full Code Here

    }

    public void testCreateBrokerWithMultipleAuthenticationProvidersAndPorts()
    {
        //Create a second authentication provider
        AuthenticationProvider authenticationProvider2 = mock(AuthenticationProvider.class);
        when(authenticationProvider2.getName()).thenReturn("authenticationProvider2");
        ConfigurationEntry authenticationProviderEntry2 = mock(ConfigurationEntry.class);
        _brokerEntryChildren.put(AuthenticationProvider.class.getSimpleName(), Arrays.asList(_authenticationProviderEntry1, authenticationProviderEntry2));

        //Add a couple ports
        ConfigurationEntry portEntry1 = mock(ConfigurationEntry.class);
View Full Code Here

TOP

Related Classes of org.apache.qpid.server.model.AuthenticationProvider

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.