From 3177060ac290e168542b215699b386978b350659 Mon Sep 17 00:00:00 2001 From: Katarina Valalikova Date: Thu, 23 Mar 2017 12:54:39 +0100 Subject: [PATCH] authentication evaluator refactoring --- .../PageResetPasswordConfirmation.java | 5 +- .../web/page/login/PageRegistrationBase.java | 9 ++-- .../login/PageRegistrationConfirmation.java | 5 +- .../MidPointAuthenticationProvider.java | 7 +-- .../security/AuthenticationEvaluatorImpl.java | 1 - .../MidpointRestAuthenticationHandler.java | 10 ++-- .../NonceAuthenticationEvaluatorImpl.java | 2 + .../PasswordAuthenticationEvaluatorImpl.java | 2 + .../model/impl/security/PasswordCallback.java | 8 +-- .../src/main/resources/ctx-model.xml | 2 +- .../security/TestAuthenticationEvaluator.java | 54 +++++++++---------- 11 files changed, 55 insertions(+), 50 deletions(-) diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/forgetpassword/PageResetPasswordConfirmation.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/forgetpassword/PageResetPasswordConfirmation.java index b91311bb3d0..bf1394fe0f4 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/forgetpassword/PageResetPasswordConfirmation.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/forgetpassword/PageResetPasswordConfirmation.java @@ -12,6 +12,7 @@ import org.springframework.security.core.AuthenticationException; import org.springframework.security.core.context.SecurityContextHolder; +import com.evolveum.midpoint.model.impl.security.NonceAuthenticationContext; import com.evolveum.midpoint.schema.constants.SchemaConstants; import com.evolveum.midpoint.schema.result.OperationResult; import com.evolveum.midpoint.schema.result.OperationResultStatus; @@ -117,8 +118,8 @@ private UsernamePasswordAuthenticationToken authenticateUser(String username, St ConnectionEnvironment connEnv = new ConnectionEnvironment(); connEnv.setChannel(SchemaConstants.CHANNEL_GUI_SELF_REGISTRATION_URI); try { - return getAuthenticationEvaluator().authenticateUserNonce(connEnv, username, - nonce, getResetPasswordPolicy().getNoncePolicy()); + return getAuthenticationEvaluator().authenticate(connEnv, new NonceAuthenticationContext(username, + nonce, getResetPasswordPolicy().getNoncePolicy())); } catch (AuthenticationException ex) { getSession() .error(getString(ex.getMessage())); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/login/PageRegistrationBase.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/login/PageRegistrationBase.java index d880621e54b..416cfd78d16 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/login/PageRegistrationBase.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/login/PageRegistrationBase.java @@ -5,6 +5,7 @@ import com.evolveum.midpoint.gui.api.page.PageBase; import com.evolveum.midpoint.model.api.AuthenticationEvaluator; +import com.evolveum.midpoint.model.impl.security.NonceAuthenticationContext; import com.evolveum.midpoint.schema.constants.SchemaConstants; import com.evolveum.midpoint.schema.result.OperationResult; import com.evolveum.midpoint.task.api.Task; @@ -22,10 +23,10 @@ public class PageRegistrationBase extends PageBase { private static final String DOT_CLASS = PageRegistrationBase.class.getName() + "."; private static final String OPERATION_GET_SECURITY_POLICY = DOT_CLASS + "getSecurityPolicy"; - private static final Trace LOGGER = TraceManager.getTrace(PageSelfRegistration.class); + private static final Trace LOGGER = TraceManager.getTrace(PageRegistrationBase.class); - @SpringBean(name = "authenticationEvaluator") - private AuthenticationEvaluator authenticationEvaluator; + @SpringBean(name = "nonceAuthenticationEvaluator") + private AuthenticationEvaluator authenticationEvaluator; private ResetPolicyDto resetPasswordPolicy; private SelfRegistrationDto selfRegistrationDto; @@ -119,7 +120,7 @@ public ResetPolicyDto getResetPasswordPolicy() { return resetPasswordPolicy; } - public AuthenticationEvaluator getAuthenticationEvaluator() { + public AuthenticationEvaluator getAuthenticationEvaluator() { return authenticationEvaluator; } diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/login/PageRegistrationConfirmation.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/login/PageRegistrationConfirmation.java index e9d89b5405a..d0d23b91899 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/login/PageRegistrationConfirmation.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/page/login/PageRegistrationConfirmation.java @@ -15,6 +15,7 @@ import org.springframework.security.core.context.SecurityContextHolder; import com.evolveum.midpoint.gui.api.util.WebModelServiceUtils; +import com.evolveum.midpoint.model.impl.security.NonceAuthenticationContext; import com.evolveum.midpoint.prism.delta.ContainerDelta; import com.evolveum.midpoint.prism.delta.ItemDelta; import com.evolveum.midpoint.prism.delta.ObjectDelta; @@ -117,8 +118,8 @@ private UsernamePasswordAuthenticationToken authenticateUser(String username, St ConnectionEnvironment connEnv = new ConnectionEnvironment(); connEnv.setChannel(SchemaConstants.CHANNEL_GUI_SELF_REGISTRATION_URI); try { - return getAuthenticationEvaluator().authenticateUserNonce(connEnv, username, - nonce, getSelfRegistrationConfiguration().getNoncePolicy()); + return getAuthenticationEvaluator().authenticate(connEnv, new NonceAuthenticationContext( username, + nonce, getSelfRegistrationConfiguration().getNoncePolicy())); } catch (AuthenticationException ex) { getSession() .error(getString(ex.getMessage())); diff --git a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/security/MidPointAuthenticationProvider.java b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/security/MidPointAuthenticationProvider.java index ae736f91bdc..a2e80e1f5ec 100644 --- a/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/security/MidPointAuthenticationProvider.java +++ b/gui/admin-gui/src/main/java/com/evolveum/midpoint/web/security/MidPointAuthenticationProvider.java @@ -26,6 +26,7 @@ import org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken; import com.evolveum.midpoint.model.api.AuthenticationEvaluator; +import com.evolveum.midpoint.model.impl.security.PasswordAuthenticationContext; import com.evolveum.midpoint.schema.constants.SchemaConstants; import com.evolveum.midpoint.security.api.ConnectionEnvironment; import com.evolveum.midpoint.security.api.MidPointPrincipal; @@ -41,7 +42,7 @@ public class MidPointAuthenticationProvider implements AuthenticationProvider { private static final Trace LOGGER = TraceManager.getTrace(MidPointAuthenticationProvider.class); @Autowired - private transient AuthenticationEvaluator authenticationEvaluator; + private transient AuthenticationEvaluator passwordAuthenticationEvaluator; @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { @@ -54,9 +55,9 @@ public Authentication authenticate(Authentication authentication) throws Authent Authentication token; if (authentication instanceof UsernamePasswordAuthenticationToken) { String enteredPassword = (String) authentication.getCredentials(); - token = authenticationEvaluator.authenticateUserPassword(connEnv, enteredUsername, enteredPassword); + token = passwordAuthenticationEvaluator.authenticate(connEnv, new PasswordAuthenticationContext(enteredUsername, enteredPassword)); } else if (authentication instanceof PreAuthenticatedAuthenticationToken) { - token = authenticationEvaluator.authenticateUserPreAuthenticated(connEnv, enteredUsername); + token = passwordAuthenticationEvaluator.authenticateUserPreAuthenticated(connEnv, enteredUsername); } else { LOGGER.error("Unsupported authentication {}", authentication); throw new AuthenticationServiceException("web.security.provider.unavailable"); diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/AuthenticationEvaluatorImpl.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/AuthenticationEvaluatorImpl.java index 4fac272f720..3e246f90456 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/AuthenticationEvaluatorImpl.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/AuthenticationEvaluatorImpl.java @@ -58,7 +58,6 @@ * @author semancik * */ -@Component("authenticationEvaluator") public abstract class AuthenticationEvaluatorImpl implements AuthenticationEvaluator { private static final Trace LOGGER = TraceManager.getTrace(AuthenticationEvaluatorImpl.class); diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/MidpointRestAuthenticationHandler.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/MidpointRestAuthenticationHandler.java index bb0a4f634f6..5f0c46932f4 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/MidpointRestAuthenticationHandler.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/MidpointRestAuthenticationHandler.java @@ -24,14 +24,10 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; -import com.evolveum.midpoint.model.impl.util.RestServiceUtil; -import com.evolveum.midpoint.prism.PrismObject; - import org.apache.commons.lang.StringUtils; import org.apache.cxf.configuration.security.AuthorizationPolicy; import org.apache.cxf.jaxrs.utils.JAXRSUtils; import org.apache.cxf.message.Message; -import org.apache.http.protocol.RequestContent; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.AccessDeniedException; import org.springframework.security.authentication.AuthenticationCredentialsNotFoundException; @@ -46,6 +42,8 @@ import com.evolveum.midpoint.model.api.AuthenticationEvaluator; import com.evolveum.midpoint.model.api.ModelService; import com.evolveum.midpoint.model.impl.ModelRestService; +import com.evolveum.midpoint.model.impl.util.RestServiceUtil; +import com.evolveum.midpoint.prism.PrismObject; import com.evolveum.midpoint.schema.constants.SchemaConstants; import com.evolveum.midpoint.schema.result.OperationResult; import com.evolveum.midpoint.security.api.AuthorizationConstants; @@ -72,7 +70,7 @@ public class MidpointRestAuthenticationHandler implements ContainerRequestFilter private static final Trace LOGGER = TraceManager.getTrace(MidpointRestAuthenticationHandler.class); @Autowired(required=true) - private AuthenticationEvaluator authenticationEvaluator; + private AuthenticationEvaluator passwordAuthenticationEvaluator; @Autowired(required = true) private SecurityEnforcer securityEnforcer; @@ -112,7 +110,7 @@ public void handleRequest(Message m, ContainerRequestContext requestCtx) { String enteredPassword = policy.getPassword(); UsernamePasswordAuthenticationToken token; try { - token = authenticationEvaluator.authenticateUserPassword(connEnv, enteredUsername, enteredPassword); + token = passwordAuthenticationEvaluator.authenticate(connEnv, new PasswordAuthenticationContext(enteredUsername, enteredPassword)); } catch (UsernameNotFoundException | BadCredentialsException e) { LOGGER.trace("Exception while authenticating username '{}' to REST service: {}", enteredUsername, e.getMessage(), e); requestCtx.abortWith(Response.status(Status.UNAUTHORIZED).header("WWW-Authenticate", "Basic authentication failed. Cannot authenticate user.").build()); diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/NonceAuthenticationEvaluatorImpl.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/NonceAuthenticationEvaluatorImpl.java index 7aa6837846d..2a8a93a1db4 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/NonceAuthenticationEvaluatorImpl.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/NonceAuthenticationEvaluatorImpl.java @@ -3,6 +3,7 @@ import org.apache.commons.lang.StringUtils; import org.springframework.security.authentication.AuthenticationCredentialsNotFoundException; import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.stereotype.Component; import com.evolveum.midpoint.security.api.ConnectionEnvironment; import com.evolveum.midpoint.security.api.MidPointPrincipal; @@ -14,6 +15,7 @@ import com.evolveum.midpoint.xml.ns._public.common.common_3.NonceType; import com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityPolicyType; +@Component("nonceAuthenticationEvaluator") public class NonceAuthenticationEvaluatorImpl extends AuthenticationEvaluatorImpl{ diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/PasswordAuthenticationEvaluatorImpl.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/PasswordAuthenticationEvaluatorImpl.java index c3a8a51054f..f6fd6189a93 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/PasswordAuthenticationEvaluatorImpl.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/PasswordAuthenticationEvaluatorImpl.java @@ -4,6 +4,7 @@ import org.jetbrains.annotations.NotNull; import org.springframework.security.authentication.AuthenticationCredentialsNotFoundException; import org.springframework.security.authentication.BadCredentialsException; +import org.springframework.stereotype.Component; import com.evolveum.midpoint.security.api.ConnectionEnvironment; import com.evolveum.midpoint.security.api.MidPointPrincipal; @@ -15,6 +16,7 @@ import com.evolveum.midpoint.xml.ns._public.common.common_3.SecurityPolicyType; import com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType; +@Component("passwordAuthenticationEvaluator") public class PasswordAuthenticationEvaluatorImpl extends AuthenticationEvaluatorImpl{ @Override diff --git a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/PasswordCallback.java b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/PasswordCallback.java index a917d3dd58e..6ec63c599ed 100644 --- a/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/PasswordCallback.java +++ b/model/model-impl/src/main/java/com/evolveum/midpoint/model/impl/security/PasswordCallback.java @@ -36,10 +36,10 @@ public class PasswordCallback implements CallbackHandler { private static final Trace LOGGER = TraceManager.getTrace(PasswordCallback.class); - private AuthenticationEvaluatorImpl authenticationEvaluatorImpl; + private PasswordAuthenticationEvaluatorImpl passwordAuthenticationEvaluatorImpl; - public PasswordCallback(AuthenticationEvaluatorImpl authenticationEvaluatorImpl) { - this.authenticationEvaluatorImpl = authenticationEvaluatorImpl; + public PasswordCallback(PasswordAuthenticationEvaluatorImpl passwordAuthenticationEvaluatorImpl) { + this.passwordAuthenticationEvaluatorImpl = passwordAuthenticationEvaluatorImpl; } public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { @@ -53,7 +53,7 @@ public void handle(Callback[] callbacks) throws IOException, UnsupportedCallback try { ConnectionEnvironment connEnv = new ConnectionEnvironment(); connEnv.setChannel(SchemaConstants.CHANNEL_WEB_SERVICE_URI); - pc.setPassword(authenticationEvaluatorImpl.getAndCheckUserPassword(connEnv, username)); + pc.setPassword(passwordAuthenticationEvaluatorImpl.getAndCheckUserPassword(connEnv, username)); } catch (Exception e) { LOGGER.trace("Exception in password callback: {}: {}", e.getClass().getSimpleName(), e.getMessage(), e); throw new PasswordCallbackException("Authentication failed"); diff --git a/model/model-impl/src/main/resources/ctx-model.xml b/model/model-impl/src/main/resources/ctx-model.xml index 85373f8d3c9..ebe2583021d 100644 --- a/model/model-impl/src/main/resources/ctx-model.xml +++ b/model/model-impl/src/main/resources/ctx-model.xml @@ -453,7 +453,7 @@ - + diff --git a/model/model-impl/src/test/java/com/evolveum/midpoint/model/impl/security/TestAuthenticationEvaluator.java b/model/model-impl/src/test/java/com/evolveum/midpoint/model/impl/security/TestAuthenticationEvaluator.java index e9353697d00..3c707e5cc1e 100644 --- a/model/model-impl/src/test/java/com/evolveum/midpoint/model/impl/security/TestAuthenticationEvaluator.java +++ b/model/model-impl/src/test/java/com/evolveum/midpoint/model/impl/security/TestAuthenticationEvaluator.java @@ -86,7 +86,7 @@ public class TestAuthenticationEvaluator extends AbstractInternalModelIntegratio private static final String USER_GUYBRUSH_PASSWORD = "XmarksTHEspot"; @Autowired(required=true) - private AuthenticationEvaluator authenticationEvaluator; + private AuthenticationEvaluator passwordAuthenticationEvaluator; @Autowired(required=true) private UserProfileService userProfileService; @@ -101,7 +101,7 @@ public class TestAuthenticationEvaluator extends AbstractInternalModelIntegratio public void initSystem(Task initTask, OperationResult initResult) throws Exception { super.initSystem(initTask, initResult); - ((AuthenticationEvaluatorImpl)authenticationEvaluator).userProfileService = new UserProfileService() { + ((PasswordAuthenticationEvaluatorImpl)passwordAuthenticationEvaluator).userProfileService = new UserProfileService() { @Override public PrismObject resolveOwner(PrismObject object) { @@ -134,7 +134,7 @@ public void test000Sanity() throws Exception { final String TEST_NAME = "test000Sanity"; TestUtil.displayTestTile(TEST_NAME); - assertNotNull(authenticationEvaluator); + assertNotNull(passwordAuthenticationEvaluator); MidPointPrincipal principal = userProfileService.getPrincipal(USER_JACK_USERNAME); assertPrincipalJack(principal); } @@ -150,7 +150,7 @@ public void test100PasswordLoginGoodPasswordJack() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); - Authentication authentication = authenticationEvaluator.authenticateUserPassword(connEnv, USER_JACK_USERNAME, USER_JACK_PASSWORD); + Authentication authentication = passwordAuthenticationEvaluator.authenticate(connEnv, new PasswordAuthenticationContext(USER_JACK_USERNAME, USER_JACK_PASSWORD)); // THEN TestUtil.displayThen(TEST_NAME); @@ -177,7 +177,7 @@ public void test101PasswordLoginBadPasswordJack() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); - authenticationEvaluator.authenticateUserPassword(connEnv, USER_JACK_USERNAME, "thisIsNotMyPassword"); + passwordAuthenticationEvaluator.authenticate(connEnv, new PasswordAuthenticationContext(USER_JACK_USERNAME, "thisIsNotMyPassword")); AssertJUnit.fail("Unexpected success"); @@ -211,7 +211,7 @@ public void test102PasswordLoginNullPasswordJack() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); - authenticationEvaluator.authenticateUserPassword(connEnv, USER_JACK_USERNAME, null); + passwordAuthenticationEvaluator.authenticate(connEnv, new PasswordAuthenticationContext(USER_JACK_USERNAME, null)); AssertJUnit.fail("Unexpected success"); @@ -244,7 +244,7 @@ public void test103PasswordLoginEmptyPasswordJack() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); - authenticationEvaluator.authenticateUserPassword(connEnv, USER_JACK_USERNAME, ""); + passwordAuthenticationEvaluator.authenticate(connEnv, new PasswordAuthenticationContext(USER_JACK_USERNAME, "")); AssertJUnit.fail("Unexpected success"); @@ -276,7 +276,7 @@ public void test105PasswordLoginNullUsernameNullPassword() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); - authenticationEvaluator.authenticateUserPassword(connEnv, null, null); + passwordAuthenticationEvaluator.authenticate(connEnv, new PasswordAuthenticationContext(null, null)); AssertJUnit.fail("Unexpected success"); @@ -304,7 +304,7 @@ public void test106PasswordLoginEmptyUsernameBadPassword() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); - authenticationEvaluator.authenticateUserPassword(connEnv, "", "bad Bad BAD"); + passwordAuthenticationEvaluator.authenticate(connEnv, new PasswordAuthenticationContext("", "bad Bad BAD")); AssertJUnit.fail("Unexpected success"); @@ -332,7 +332,7 @@ public void test107PasswordLoginBadUsernameBadPassword() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); - authenticationEvaluator.authenticateUserPassword(connEnv, "NoSuchUser", "bad Bad BAD"); + passwordAuthenticationEvaluator.authenticate(connEnv, new PasswordAuthenticationContext("NoSuchUser", "bad Bad BAD")); AssertJUnit.fail("Unexpected success"); @@ -367,7 +367,7 @@ public void test125PasswordLoginBadPasswordJackAfterLockoutFailedAttemptsDuratio // WHEN TestUtil.displayWhen(TEST_NAME); - authenticationEvaluator.authenticateUserPassword(connEnv, USER_JACK_USERNAME, "thisIsNotMyPassword"); + passwordAuthenticationEvaluator.authenticate(connEnv, new PasswordAuthenticationContext(USER_JACK_USERNAME, "thisIsNotMyPassword")); AssertJUnit.fail("Unexpected success"); @@ -402,7 +402,7 @@ public void test130PasswordLoginLockout() throws Exception { TestUtil.displayWhen(TEST_NAME); try { - authenticationEvaluator.authenticateUserPassword(connEnv, USER_JACK_USERNAME, "not my password either"); + passwordAuthenticationEvaluator.authenticate(connEnv, new PasswordAuthenticationContext(USER_JACK_USERNAME, "not my password either")); AssertJUnit.fail("Unexpected success"); } catch (BadCredentialsException e) { @@ -419,7 +419,7 @@ public void test130PasswordLoginLockout() throws Exception { try { - authenticationEvaluator.authenticateUserPassword(connEnv, USER_JACK_USERNAME, "absoLUTELY NOT my PASSword"); + passwordAuthenticationEvaluator.authenticate(connEnv, new PasswordAuthenticationContext(USER_JACK_USERNAME, "absoLUTELY NOT my PASSword")); AssertJUnit.fail("Unexpected success"); } catch (BadCredentialsException e) { @@ -454,7 +454,7 @@ public void test132PasswordLoginLockedoutGoodPassword() throws Exception { TestUtil.displayWhen(TEST_NAME); try { - authenticationEvaluator.authenticateUserPassword(connEnv, USER_JACK_USERNAME, USER_JACK_PASSWORD); + passwordAuthenticationEvaluator.authenticate(connEnv, new PasswordAuthenticationContext(USER_JACK_USERNAME, USER_JACK_PASSWORD)); AssertJUnit.fail("Unexpected success"); } catch (LockedException e) { @@ -484,7 +484,7 @@ public void test133PasswordLoginLockedoutBadPassword() throws Exception { TestUtil.displayWhen(TEST_NAME); try { - authenticationEvaluator.authenticateUserPassword(connEnv, USER_JACK_USERNAME, "bad bad password!"); + passwordAuthenticationEvaluator.authenticate(connEnv, new PasswordAuthenticationContext(USER_JACK_USERNAME, "bad bad password!")); AssertJUnit.fail("Unexpected success"); } catch (LockedException e) { @@ -518,7 +518,7 @@ public void test135PasswordLoginLockedoutLockExpires() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); - Authentication authentication = authenticationEvaluator.authenticateUserPassword(connEnv, USER_JACK_USERNAME, USER_JACK_PASSWORD); + Authentication authentication = passwordAuthenticationEvaluator.authenticate(connEnv, new PasswordAuthenticationContext(USER_JACK_USERNAME, USER_JACK_PASSWORD)); // THEN TestUtil.displayThen(TEST_NAME); @@ -545,7 +545,7 @@ public void test136PasswordLoginLockoutAgain() throws Exception { TestUtil.displayWhen(TEST_NAME); try { - authenticationEvaluator.authenticateUserPassword(connEnv, USER_JACK_USERNAME, "not my password either"); + passwordAuthenticationEvaluator.authenticate(connEnv, new PasswordAuthenticationContext(USER_JACK_USERNAME, "not my password either")); AssertJUnit.fail("Unexpected success"); } catch (BadCredentialsException e) { @@ -564,7 +564,7 @@ public void test136PasswordLoginLockoutAgain() throws Exception { try { - authenticationEvaluator.authenticateUserPassword(connEnv, USER_JACK_USERNAME, "absoLUTELY NOT my PASSword"); + passwordAuthenticationEvaluator.authenticate(connEnv, new PasswordAuthenticationContext(USER_JACK_USERNAME, "absoLUTELY NOT my PASSword")); AssertJUnit.fail("Unexpected success"); } catch (BadCredentialsException e) { @@ -583,7 +583,7 @@ public void test136PasswordLoginLockoutAgain() throws Exception { try { - authenticationEvaluator.authenticateUserPassword(connEnv, USER_JACK_USERNAME, "no, no NO!"); + passwordAuthenticationEvaluator.authenticate(connEnv, new PasswordAuthenticationContext(USER_JACK_USERNAME, "no, no NO!")); AssertJUnit.fail("Unexpected success"); } catch (BadCredentialsException e) { @@ -617,7 +617,7 @@ public void test137PasswordLoginLockedoutGoodPasswordAgain() throws Exception { TestUtil.displayWhen(TEST_NAME); try { - authenticationEvaluator.authenticateUserPassword(connEnv, USER_JACK_USERNAME, USER_JACK_PASSWORD); + passwordAuthenticationEvaluator.authenticate(connEnv, new PasswordAuthenticationContext(USER_JACK_USERNAME, USER_JACK_PASSWORD)); AssertJUnit.fail("Unexpected success"); } catch (LockedException e) { @@ -663,7 +663,7 @@ public void test138UnlockUserGoodPassword() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); - Authentication authentication = authenticationEvaluator.authenticateUserPassword(connEnv, USER_JACK_USERNAME, USER_JACK_PASSWORD); + Authentication authentication = passwordAuthenticationEvaluator.authenticate(connEnv, new PasswordAuthenticationContext(USER_JACK_USERNAME, USER_JACK_PASSWORD)); // THEN TestUtil.displayThen(TEST_NAME); @@ -915,7 +915,7 @@ public void test201UserGuybrushPasswordLoginGoodPassword() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); - Authentication authentication = authenticationEvaluator.authenticateUserPassword(connEnv, USER_GUYBRUSH_USERNAME, USER_GUYBRUSH_PASSWORD); + Authentication authentication = passwordAuthenticationEvaluator.authenticate(connEnv, new PasswordAuthenticationContext(USER_GUYBRUSH_USERNAME, USER_GUYBRUSH_PASSWORD)); // THEN TestUtil.displayThen(TEST_NAME); @@ -942,7 +942,7 @@ public void test202UserGuybrushPasswordLoginBadPassword() throws Exception { // WHEN TestUtil.displayWhen(TEST_NAME); - authenticationEvaluator.authenticateUserPassword(connEnv, USER_GUYBRUSH_USERNAME, "thisIsNotMyPassword"); + passwordAuthenticationEvaluator.authenticate(connEnv, new PasswordAuthenticationContext(USER_GUYBRUSH_USERNAME, "thisIsNotMyPassword")); AssertJUnit.fail("Unexpected success"); @@ -975,7 +975,7 @@ public void test209UserGuybrushPasswordLoginGoodPasswordBeforeExpiration() throw // WHEN TestUtil.displayWhen(TEST_NAME); - Authentication authentication = authenticationEvaluator.authenticateUserPassword(connEnv, USER_GUYBRUSH_USERNAME, USER_GUYBRUSH_PASSWORD); + Authentication authentication = passwordAuthenticationEvaluator.authenticate(connEnv, new PasswordAuthenticationContext(USER_GUYBRUSH_USERNAME, USER_GUYBRUSH_PASSWORD)); // THEN TestUtil.displayThen(TEST_NAME); @@ -1004,7 +1004,7 @@ public void test210UserGuybrushPasswordLoginGoodPasswordExpired() throws Excepti // WHEN TestUtil.displayWhen(TEST_NAME); - authenticationEvaluator.authenticateUserPassword(connEnv, USER_GUYBRUSH_USERNAME, USER_GUYBRUSH_PASSWORD); + passwordAuthenticationEvaluator.authenticate(connEnv, new PasswordAuthenticationContext(USER_GUYBRUSH_USERNAME, USER_GUYBRUSH_PASSWORD)); AssertJUnit.fail("Unexpected success"); @@ -1114,7 +1114,7 @@ private void loginJackGoodPasswordExpectSuccess(final String TEST_NAME, Task tas // WHEN TestUtil.displayWhen(TEST_NAME); - Authentication authentication = authenticationEvaluator.authenticateUserPassword(connEnv, USER_JACK_USERNAME, USER_JACK_PASSWORD); + Authentication authentication = passwordAuthenticationEvaluator.authenticate(connEnv, new PasswordAuthenticationContext(USER_JACK_USERNAME, USER_JACK_PASSWORD)); // THEN TestUtil.displayThen(TEST_NAME); @@ -1136,7 +1136,7 @@ private void loginJackGoodPasswordExpectDenied(final String TEST_NAME, Task task TestUtil.displayWhen(TEST_NAME); try { - authenticationEvaluator.authenticateUserPassword(connEnv, USER_JACK_USERNAME, USER_JACK_PASSWORD); + passwordAuthenticationEvaluator.authenticate(connEnv, new PasswordAuthenticationContext(USER_JACK_USERNAME, USER_JACK_PASSWORD)); AssertJUnit.fail("Unexpected success"); } catch (DisabledException e) {