use of org.apache.qpid.server.security.auth.AuthenticationResult in project qpid-broker-j by apache.
the class OAuth2NegotiatorTest method doHandleResponseWithValidResponse.
private void doHandleResponseWithValidResponse(final byte[] validResponse) {
final AuthenticationResult expectedResult = mock(AuthenticationResult.class);
when(_authenticationProvider.authenticateViaAccessToken(eq(VALID_TOKEN), any())).thenReturn(expectedResult);
AuthenticationResult actualResult = _negotiator.handleResponse(validResponse);
assertEquals("Unexpected result", expectedResult, actualResult);
verify(_authenticationProvider).authenticateViaAccessToken(eq(VALID_TOKEN), any());
AuthenticationResult secondResult = _negotiator.handleResponse(validResponse);
assertEquals("Unexpected second result status", AuthenticationResult.AuthenticationStatus.ERROR, secondResult.getStatus());
}
use of org.apache.qpid.server.security.auth.AuthenticationResult in project qpid-broker-j by apache.
the class OAuth2NegotiatorTest method testHandleNoInitialResponse.
public void testHandleNoInitialResponse() throws Exception {
final AuthenticationResult result = _negotiator.handleResponse(new byte[0]);
assertEquals("Unexpected authentication status", AuthenticationResult.AuthenticationStatus.CONTINUE, result.getStatus());
assertArrayEquals("Unexpected authentication challenge", new byte[0], result.getChallenge());
}
use of org.apache.qpid.server.security.auth.AuthenticationResult in project qpid-broker-j by apache.
the class PlainNegotiatorTest method testHandleNoInitialResponseNull.
public void testHandleNoInitialResponseNull() throws Exception {
final AuthenticationResult result = _negotiator.handleResponse(null);
assertEquals("Unexpected authentication status", AuthenticationResult.AuthenticationStatus.CONTINUE, result.getStatus());
assertArrayEquals("Unexpected authentication challenge", new byte[0], result.getChallenge());
final AuthenticationResult firstResult = _negotiator.handleResponse(VALID_RESPONSE.getBytes());
assertEquals("Unexpected first authentication result", _successfulResult, firstResult);
}
use of org.apache.qpid.server.security.auth.AuthenticationResult in project qpid-broker-j by apache.
the class PlainNegotiatorTest method testHandleNoInitialResponse.
public void testHandleNoInitialResponse() throws Exception {
final AuthenticationResult result = _negotiator.handleResponse(new byte[0]);
assertEquals("Unexpected authentication status", AuthenticationResult.AuthenticationStatus.CONTINUE, result.getStatus());
assertArrayEquals("Unexpected authentication challenge", new byte[0], result.getChallenge());
final AuthenticationResult firstResult = _negotiator.handleResponse(VALID_RESPONSE.getBytes());
assertEquals("Unexpected first authentication result", _successfulResult, firstResult);
}
use of org.apache.qpid.server.security.auth.AuthenticationResult in project qpid-broker-j by apache.
the class PlainNegotiatorTest method testMultipleAuthenticationAttempts.
public void testMultipleAuthenticationAttempts() throws Exception {
final AuthenticationResult firstResult = _negotiator.handleResponse(VALID_RESPONSE.getBytes(US_ASCII));
assertEquals("Unexpected first authentication result", _successfulResult, firstResult);
final AuthenticationResult secondResult = _negotiator.handleResponse(VALID_RESPONSE.getBytes(US_ASCII));
assertEquals("Unexpected second authentication result", AuthenticationResult.AuthenticationStatus.ERROR, secondResult.getStatus());
}
Aggregations