137 String username = inputData.getFirst(AuthenticationManager.FORM_USERNAME);
138 if (username == null) {
139 context.getEvent().error(Errors.USER_NOT_FOUND);
141 context.failureChallenge(AuthenticationFlowError.INVALID_USER, challengeResponse);
146 username = username.trim();
148 context.getEvent().detail(Details.USERNAME, username);
149 context.getAuthenticationSession().setAuthNote(AbstractUsernameFormAuthenticator.ATTEMPTED_USERNAME, username);
151 UserModel user = null;
153 user = KeycloakModelUtils.findUserByNameOrEmail(context.getSession(), context.getRealm(), username);
154 }
catch (ModelDuplicateException mde) {
155 ServicesLogger.LOGGER.modelDuplicateException(mde);
158 if (mde.getDuplicateFieldName() != null && mde.getDuplicateFieldName().equals(UserModel.EMAIL)) {
161 setDuplicateUserChallenge(context, Errors.USERNAME_IN_USE, Messages.USERNAME_EXISTS, AuthenticationFlowError.INVALID_USER);
179 String rememberMe = inputData.getFirst(
"rememberMe");
180 boolean remember = rememberMe != null && rememberMe.equalsIgnoreCase(
"on");
182 context.getAuthenticationSession().setAuthNote(Details.REMEMBER_ME,
"true");
183 context.getEvent().detail(Details.REMEMBER_ME,
"true");
185 context.getAuthenticationSession().removeAuthNote(Details.REMEMBER_ME);
187 context.setUser(user);
boolean validatePassword(AuthenticationFlowContext context, UserModel user, MultivaluedMap< String, String > inputData)
Definition: AbstractUsernameFormAuthenticator.java:191
Response invalidUser(AuthenticationFlowContext context)
Definition: AbstractUsernameFormAuthenticator.java:59
boolean enabledUser(AuthenticationFlowContext context, UserModel user)
Definition: AbstractUsernameFormAuthenticator.java:122
Response setDuplicateUserChallenge(AuthenticationFlowContext context, String eventError, String loginFormError, AuthenticationFlowError authenticatorError)
Definition: AbstractUsernameFormAuthenticator.java:80