use of javax.security.auth.kerberos.KerberosPrincipal in project qpid-broker-j by apache.
the class KerberosAuthenticationManagerTest method testCreateSaslNegotiator.
@Test
public void testCreateSaslNegotiator() throws Exception {
final SaslSettings saslSettings = mock(SaslSettings.class);
when(saslSettings.getLocalFQDN()).thenReturn(HOST_NAME);
final SaslNegotiator negotiator = _kerberosAuthenticationProvider.createSaslNegotiator(GSSAPI_MECHANISM, saslSettings, null);
assertNotNull("Could not create SASL negotiator", negotiator);
try {
final AuthenticationResult result = authenticate(negotiator);
assertEquals(AuthenticationResult.AuthenticationStatus.SUCCESS, result.getStatus());
assertEquals(new KerberosPrincipal(CLIENT_PRINCIPAL_FULL_NAME).getName(), result.getMainPrincipal().getName());
} finally {
negotiator.dispose();
}
}
Aggregations