@Test public void testVanillaAuthenticationSuccess() { when(mockPasswordAuthenticator.newSaslNegotiator()).thenReturn(mockNegotiator); SaslNegotiator negotiator = authenticator.newSaslNegotiator(); byte[] clientResponse = createClientResponse("user1", "password1"); negotiator.evaluateResponse(clientResponse); verify(mockNegotiator, times(1)).evaluateResponse(eq(clientResponse)); negotiator.isComplete(); verify(mockNegotiator, times(1)).isComplete(); negotiator.getAuthenticatedUser(); verify(mockNegotiator, times(1)).getAuthenticatedUser(); }
@Override public SaslNegotiator newSaslNegotiator() { return newDecoratedSaslNegotiator(); }
DecoratedPasswordAuthenticator implements IDecoratedAuthenticator { @Override public SaslNegotiator newSaslNegotiator() { return newDecoratedSaslNegotiator(); } }
DecoratedPasswordAuthenticator implements IDecoratedAuthenticator { @Override public SaslNegotiator newSaslNegotiator() { return newDecoratedSaslNegotiator(); } DecoratedPasswordAuthenticator(); @VisibleForTesting  DecoratedPasswordAuthenticator(PasswordAuthenticator authenticator); }
DecoratedPasswordAuthenticator implements IDecoratedAuthenticator { @Override public SaslNegotiator newSaslNegotiator() { return newDecoratedSaslNegotiator(); } DecoratedPasswordAuthenticator(); @VisibleForTesting  DecoratedPasswordAuthenticator(PasswordAuthenticator authenticator); @Override boolean requireAuthentication(); @Override Set<? extends IResource> protectedResources(); @Override void validateConfiguration(); @Override void setup(); @Override Set<IRoleManager.Option> supportedOptions(); @Override Set<IRoleManager.Option> alterableOptions(); @Override SaslNegotiator newSaslNegotiator(); @Override DecoratedSaslNegotiator newDecoratedSaslNegotiator(); @Override AuthenticatedUser legacyAuthenticate(Map<String, String> credentials); }
DecoratedPasswordAuthenticator implements IDecoratedAuthenticator { @Override public SaslNegotiator newSaslNegotiator() { return newDecoratedSaslNegotiator(); } DecoratedPasswordAuthenticator(); @VisibleForTesting  DecoratedPasswordAuthenticator(PasswordAuthenticator authenticator); @Override boolean requireAuthentication(); @Override Set<? extends IResource> protectedResources(); @Override void validateConfiguration(); @Override void setup(); @Override Set<IRoleManager.Option> supportedOptions(); @Override Set<IRoleManager.Option> alterableOptions(); @Override SaslNegotiator newSaslNegotiator(); @Override DecoratedSaslNegotiator newDecoratedSaslNegotiator(); @Override AuthenticatedUser legacyAuthenticate(Map<String, String> credentials);  }