Java Code Examples for org.keycloak.models.UserModel#RequiredAction
The following examples show how to use
org.keycloak.models.UserModel#RequiredAction .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UserAttributeUpdater.java From keycloak with Apache License 2.0 | 5 votes |
public UserAttributeUpdater setRequiredActions(UserModel.RequiredAction... requiredAction) { rep.setRequiredActions(Arrays.stream(requiredAction) .map(action -> action.name()) .collect(Collectors.toList()) ); return this; }
Example 2
Source File: FreeMarkerLoginFormsProvider.java From keycloak with Apache License 2.0 | 5 votes |
@Override public Response createResponse(UserModel.RequiredAction action) { String actionMessage; LoginFormsPages page; switch (action) { case CONFIGURE_TOTP: actionMessage = Messages.CONFIGURE_TOTP; page = LoginFormsPages.LOGIN_CONFIG_TOTP; break; case UPDATE_PROFILE: UpdateProfileContext userBasedContext = new UserUpdateProfileContext(realm, user); this.attributes.put(UPDATE_PROFILE_CONTEXT_ATTR, userBasedContext); actionMessage = Messages.UPDATE_PROFILE; page = LoginFormsPages.LOGIN_UPDATE_PROFILE; break; case UPDATE_PASSWORD: boolean isRequestedByAdmin = user.getRequiredActions().stream().filter(Objects::nonNull).anyMatch(UPDATE_PASSWORD.toString()::contains); actionMessage = isRequestedByAdmin ? Messages.UPDATE_PASSWORD : Messages.RESET_PASSWORD; page = LoginFormsPages.LOGIN_UPDATE_PASSWORD; break; case VERIFY_EMAIL: actionMessage = Messages.VERIFY_EMAIL; page = LoginFormsPages.LOGIN_VERIFY_EMAIL; break; default: return Response.serverError().build(); } if (messages == null) { setMessage(MessageType.WARNING, actionMessage); } return createResponse(page); }
Example 3
Source File: AuthenticationSessionAdapter.java From keycloak with Apache License 2.0 | 4 votes |
@Override public void addRequiredAction(UserModel.RequiredAction action) { addRequiredAction(action.name()); }
Example 4
Source File: AuthenticationSessionAdapter.java From keycloak with Apache License 2.0 | 4 votes |
@Override public void removeRequiredAction(UserModel.RequiredAction action) { removeRequiredAction(action.name()); }
Example 5
Source File: LoginFormsProvider.java From keycloak with Apache License 2.0 | votes |
Response createResponse(UserModel.RequiredAction action);
Example 6
Source File: AuthenticationSessionModel.java From keycloak with Apache License 2.0 | votes |
void addRequiredAction(UserModel.RequiredAction action);
Example 7
Source File: AuthenticationSessionModel.java From keycloak with Apache License 2.0 | votes |
void removeRequiredAction(UserModel.RequiredAction action);