.build(); Authenticator.Context authenticatorContext = new Authenticator.Context(credentials.getLogin(), credentials.getPassword().orElse(null), request); boolean status = authenticator.doAuthenticate(authenticatorContext); if (!status) {
.build(); Authenticator.Context authenticatorContext = new Authenticator.Context(userLogin, userPassword, request); boolean status = authenticator.doAuthenticate(authenticatorContext); if (!status) {
@Override public boolean doAuthenticate(Context context) { return getLoginPasswordAuthenticator().authenticate(context.getUsername(), context.getPassword()); } };
@Override public boolean doAuthenticate(Context context) { return getLoginPasswordAuthenticator().authenticate(context.getUsername(), context.getPassword()); } };
@Test public void getLoginPasswordAuthenticator_deprecated_method_replaced_by_getAuthenticator() { final LoginPasswordAuthenticator deprecatedAuthenticator = mock(LoginPasswordAuthenticator.class); SecurityRealm realm = new SecurityRealm() { @Override public LoginPasswordAuthenticator getLoginPasswordAuthenticator() { return deprecatedAuthenticator; } }; Authenticator proxy = realm.doGetAuthenticator(); Authenticator.Context context = new Authenticator.Context("foo", "bar", mock(HttpServletRequest.class)); proxy.doAuthenticate(context); verify(deprecatedAuthenticator).authenticate("foo", "bar"); } }
@Override public boolean doAuthenticate(Context context) { return getLoginPasswordAuthenticator().authenticate(context.getUsername(), context.getPassword()); } };