use of org.apache.qpid.server.security.auth.AuthenticationResult in project qpid-broker-j by apache.
the class PrincipalDatabaseAuthenticationManagerTest method testSaslAuthenticationNotCompleted.
/**
* Tests that the authenticate method correctly interprets an
* authentication not complete.
*/
public void testSaslAuthenticationNotCompleted() throws Exception {
setupMocks();
when(_saslNegotiator.handleResponse(any(byte[].class))).thenReturn(new AuthenticationResult(AuthenticationStatus.CONTINUE));
AuthenticationResult result = _saslNegotiator.handleResponse("12345".getBytes());
assertEquals("Principals was not expected size", 0, result.getPrincipals().size());
assertEquals(AuthenticationStatus.CONTINUE, result.getStatus());
}
use of org.apache.qpid.server.security.auth.AuthenticationResult in project qpid-broker-j by apache.
the class PrincipalDatabaseAuthenticationManagerTest method testNonSaslAuthenticationSuccess.
public void testNonSaslAuthenticationSuccess() throws Exception {
setupMocks();
when(_principalDatabase.verifyPassword("guest", "guest".toCharArray())).thenReturn(true);
AuthenticationResult result = _manager.authenticate("guest", "guest");
UsernamePrincipal expectedPrincipal = new UsernamePrincipal("guest", _manager);
assertOnlyContainsWrapped(expectedPrincipal, result.getPrincipals());
assertEquals(AuthenticationStatus.SUCCESS, result.getStatus());
}
use of org.apache.qpid.server.security.auth.AuthenticationResult in project qpid-broker-j by apache.
the class SimpleAuthenticationManagerTest method testAuthenticateWithPlainSaslServerInvalidPassword.
public void testAuthenticateWithPlainSaslServerInvalidPassword() throws Exception {
AuthenticationResult result = authenticatePlain(TEST_USER, "wrong-password");
assertUnauthenticated(result);
}
use of org.apache.qpid.server.security.auth.AuthenticationResult in project qpid-broker-j by apache.
the class SimpleAuthenticationManagerTest method testAuthenticateWithPlainSaslServer.
public void testAuthenticateWithPlainSaslServer() throws Exception {
AuthenticationResult result = authenticatePlain(TEST_USER, TEST_PASSWORD);
assertAuthenticated(result);
}
use of org.apache.qpid.server.security.auth.AuthenticationResult in project qpid-broker-j by apache.
the class SimpleAuthenticationManagerTest method testAuthenticateInvalidUserName.
public void testAuthenticateInvalidUserName() {
AuthenticationResult result = _authenticationManager.authenticate("invalid", TEST_PASSWORD);
assertUnauthenticated(result);
}
Aggregations