Search in sources :

Example 6 with SaslSettings

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

the class SimpleAuthenticationManagerTest method authenticateCramMd5.

private AuthenticationResult authenticateCramMd5(String userName, String userPassword) throws Exception {
    SaslSettings saslSettings = mock(SaslSettings.class);
    when(saslSettings.getLocalFQDN()).thenReturn("testHost");
    SaslNegotiator saslNegotiator = _authenticationManager.createSaslNegotiator("CRAM-MD5", saslSettings, null);
    AuthenticationResult result = saslNegotiator.handleResponse(new byte[0]);
    assertEquals("Unexpected SASL status", AuthenticationStatus.CONTINUE, result.getStatus());
    byte[] challenge = result.getChallenge();
    byte[] response = SaslUtil.generateCramMD5ClientResponse(userName, userPassword, challenge);
    return saslNegotiator.handleResponse(response);
}
Also used : SaslSettings(org.apache.qpid.server.security.auth.sasl.SaslSettings) SaslNegotiator(org.apache.qpid.server.security.auth.sasl.SaslNegotiator) AuthenticationResult(org.apache.qpid.server.security.auth.AuthenticationResult)

Aggregations

SaslNegotiator (org.apache.qpid.server.security.auth.sasl.SaslNegotiator)6 SaslSettings (org.apache.qpid.server.security.auth.sasl.SaslSettings)6 HttpSession (javax.servlet.http.HttpSession)1 SessionInvalidatedException (org.apache.qpid.server.management.plugin.SessionInvalidatedException)1 SubjectCreator (org.apache.qpid.server.security.SubjectCreator)1 AuthenticationResult (org.apache.qpid.server.security.auth.AuthenticationResult)1