Search in sources :

Example 41 with NamedAddressSpace

use of org.apache.qpid.server.model.NamedAddressSpace in project qpid-broker-j by apache.

the class VirtualHostAliasTest method testDefaultAliases_VirtualHostNameAlias.

public void testDefaultAliases_VirtualHostNameAlias() {
    NamedAddressSpace addressSpace = _port.getAddressSpace("red");
    assertNotNull(addressSpace);
    assertEquals(_vhosts.get("red"), addressSpace);
    addressSpace = _port.getAddressSpace("blue");
    assertNotNull(addressSpace);
    assertEquals(_vhosts.get("blue"), addressSpace);
    addressSpace = _port.getAddressSpace("orange!");
    assertNull(addressSpace);
}
Also used : NamedAddressSpace(org.apache.qpid.server.model.NamedAddressSpace)

Example 42 with NamedAddressSpace

use of org.apache.qpid.server.model.NamedAddressSpace in project qpid-broker-j by apache.

the class OAuth2AuthenticationProviderImplTest method testFailAuthenticateViaInvalidAuthorizationCode.

public void testFailAuthenticateViaInvalidAuthorizationCode() throws Exception {
    Map<String, OAuth2MockEndpoint> mockEndpoints = new HashMap<>();
    final OAuth2MockEndpoint mockTokenEndpoint = createMockTokenEndpoint();
    mockTokenEndpoint.putExpectedParameter("code", TEST_INVALID_AUTHORIZATION_CODE);
    mockTokenEndpoint.setResponse(400, "{\"error\":\"invalid_grant\",\"error_description\":\"authorization grant is not valid\"}");
    mockEndpoints.put(TEST_TOKEN_ENDPOINT_PATH, mockTokenEndpoint);
    mockEndpoints.put(TEST_IDENTITY_RESOLVER_ENDPOINT_PATH, createMockIdentityResolverEndpoint());
    _server.setEndpoints(mockEndpoints);
    final NamedAddressSpace mockAddressSpace = mock(NamedAddressSpace.class);
    when(mockAddressSpace.getName()).thenReturn("mock");
    AuthenticationResult authenticationResult = _authProvider.authenticateViaAuthorizationCode(TEST_INVALID_AUTHORIZATION_CODE, TEST_REDIRECT_URI, mockAddressSpace);
    assertFailure(authenticationResult, "invalid_grant");
}
Also used : HashMap(java.util.HashMap) NamedAddressSpace(org.apache.qpid.server.model.NamedAddressSpace) AuthenticationResult(org.apache.qpid.server.security.auth.AuthenticationResult)

Aggregations

NamedAddressSpace (org.apache.qpid.server.model.NamedAddressSpace)42 AccessControlException (java.security.AccessControlException)22 HashMap (java.util.HashMap)12 MessageSource (org.apache.qpid.server.message.MessageSource)8 AbstractConfiguredObject (org.apache.qpid.server.model.AbstractConfiguredObject)8 Queue (org.apache.qpid.server.model.Queue)6 Collection (java.util.Collection)5 LinkedHashMap (java.util.LinkedHashMap)5 Map (java.util.Map)5 Symbol (org.apache.qpid.server.protocol.v1_0.type.Symbol)5 ConcurrentLinkedQueue (java.util.concurrent.ConcurrentLinkedQueue)4 IllegalConfigurationException (org.apache.qpid.server.configuration.IllegalConfigurationException)4 MessageDestination (org.apache.qpid.server.message.MessageDestination)4 AmqpPort (org.apache.qpid.server.model.port.AmqpPort)4 ArrayList (java.util.ArrayList)3 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)3 Exchange (org.apache.qpid.server.model.Exchange)3 BaseSource (org.apache.qpid.server.protocol.v1_0.type.BaseSource)3 Source (org.apache.qpid.server.protocol.v1_0.type.messaging.Source)3 AmqpError (org.apache.qpid.server.protocol.v1_0.type.transport.AmqpError)3