Search in sources :

Example 16 with AuthenticationResult

use of org.apache.qpid.server.security.auth.AuthenticationResult in project qpid-broker-j by apache.

the class SimpleAuthenticationManagerTest method testAuthenticateValidCredentials.

public void testAuthenticateValidCredentials() {
    AuthenticationResult result = _authenticationManager.authenticate(TEST_USER, TEST_PASSWORD);
    assertEquals("Unexpected authentication result", AuthenticationStatus.SUCCESS, result.getStatus());
    assertAuthenticated(result);
}
Also used : AuthenticationResult(org.apache.qpid.server.security.auth.AuthenticationResult)

Example 17 with AuthenticationResult

use of org.apache.qpid.server.security.auth.AuthenticationResult in project qpid-broker-j by apache.

the class SimpleAuthenticationManagerTest method testAuthenticateWithCramMd5SaslServerInvalidPassword.

public void testAuthenticateWithCramMd5SaslServerInvalidPassword() throws Exception {
    AuthenticationResult result = authenticateCramMd5(TEST_USER, "wrong-password");
    assertUnauthenticated(result);
}
Also used : AuthenticationResult(org.apache.qpid.server.security.auth.AuthenticationResult)

Example 18 with AuthenticationResult

use of org.apache.qpid.server.security.auth.AuthenticationResult in project qpid-broker-j by apache.

the class SimpleAuthenticationManagerTest method testAuthenticateWithCramMd5SaslServerInvalidUsername.

public void testAuthenticateWithCramMd5SaslServerInvalidUsername() throws Exception {
    AuthenticationResult result = authenticateCramMd5("wrong-user", TEST_PASSWORD);
    assertUnauthenticated(result);
}
Also used : AuthenticationResult(org.apache.qpid.server.security.auth.AuthenticationResult)

Example 19 with AuthenticationResult

use of org.apache.qpid.server.security.auth.AuthenticationResult in project qpid-broker-j by apache.

the class OAuth2AuthenticationProviderImplTest method testAuthenticateViaAuthorizationCode.

public void testAuthenticateViaAuthorizationCode() throws Exception {
    Map<String, OAuth2MockEndpoint> mockEndpoints = new HashMap<>();
    mockEndpoints.put(TEST_TOKEN_ENDPOINT_PATH, createMockTokenEndpoint());
    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_VALID_AUTHORIZATION_CODE, TEST_REDIRECT_URI, mockAddressSpace);
    assertSuccess(authenticationResult);
}
Also used : HashMap(java.util.HashMap) NamedAddressSpace(org.apache.qpid.server.model.NamedAddressSpace) AuthenticationResult(org.apache.qpid.server.security.auth.AuthenticationResult)

Example 20 with AuthenticationResult

use of org.apache.qpid.server.security.auth.AuthenticationResult in project qpid-broker-j by apache.

the class OAuth2AuthenticationProviderImplTest method testAuthenticateViaAccessToken.

public void testAuthenticateViaAccessToken() throws Exception {
    _server.setEndpoints(Collections.singletonMap(TEST_IDENTITY_RESOLVER_ENDPOINT_PATH, createMockIdentityResolverEndpoint()));
    AuthenticationResult authenticationResult = _authProvider.authenticateViaAccessToken(TEST_VALID_ACCESS_TOKEN, null);
    assertSuccess(authenticationResult);
}
Also used : AuthenticationResult(org.apache.qpid.server.security.auth.AuthenticationResult)

Aggregations

AuthenticationResult (org.apache.qpid.server.security.auth.AuthenticationResult)78 UsernamePrincipal (org.apache.qpid.server.security.auth.UsernamePrincipal)13 SaslNegotiator (org.apache.qpid.server.security.auth.sasl.SaslNegotiator)13 X500Principal (javax.security.auth.x500.X500Principal)12 SubjectAuthenticationResult (org.apache.qpid.server.security.auth.SubjectAuthenticationResult)9 HashMap (java.util.HashMap)6 SubjectCreator (org.apache.qpid.server.security.SubjectCreator)6 Subject (javax.security.auth.Subject)5 IOException (java.io.IOException)4 OAuth2AuthenticationProvider (org.apache.qpid.server.security.auth.manager.oauth2.OAuth2AuthenticationProvider)4 InetSocketAddress (java.net.InetSocketAddress)3 URISyntaxException (java.net.URISyntaxException)3 Principal (java.security.Principal)3 Broker (org.apache.qpid.server.model.Broker)3 NamedAddressSpace (org.apache.qpid.server.model.NamedAddressSpace)3 AuthenticatedPrincipal (org.apache.qpid.server.security.auth.AuthenticatedPrincipal)3 URI (java.net.URI)2 AccessControlException (java.security.AccessControlException)2 EventLogger (org.apache.qpid.server.logging.EventLogger)2 User (org.apache.qpid.server.model.User)2