Class AbstractUserProfileBean

java.lang.Object
org.keycloak.forms.login.freemarker.model.AbstractUserProfileBean
Direct Known Subclasses:
EmailBean, IdpReviewProfileBean, RegisterBean, VerifyProfileBean

public abstract class AbstractUserProfileBean extends Object
Abstract base for Freemarker context bean providing informations about user profile to render dynamic or crafted forms.
Author:
Vlastimil Elias <velias@redhat.com>
  • Field Details

  • Constructor Details

    • AbstractUserProfileBean

      public AbstractUserProfileBean(jakarta.ws.rs.core.MultivaluedMap<String,String> formData)
  • Method Details

    • init

      protected void init(KeycloakSession session, boolean writeableOnly)
      Subclass have to call this method at the end of constructor to init user profile data.
      Parameters:
      session -
      writeableOnly - if true then only writeable (no read-only) attributes are put into template, if false then all readable attributes are there
    • createUserProfile

      protected abstract UserProfile createUserProfile(UserProfileProvider provider)
      Create UserProfile instance of the relevant type. Is called from init(KeycloakSession, boolean).
      Parameters:
      provider - to create UserProfile from
      Returns:
      user profile instance
    • getAttributeDefaultValues

      protected abstract Stream<String> getAttributeDefaultValues(String name)
      Get attribute default values to be pre-filled into the form on first show.
      Parameters:
      name - of the attribute
      Returns:
      attribute default value (can be null)
    • getContext

      public abstract String getContext()
      Get context the template is used for, so view can be customized for distinct contexts.
      Returns:
      name of the context
    • getAttributes

      public List<AbstractUserProfileBean.Attribute> getAttributes()
      All attributes to be shown in form sorted by the configured GUI order. Useful to render dynamic form.
      Returns:
      list of attributes
    • getHtml5DataAnnotations

      public Map<String,Object> getHtml5DataAnnotations()
    • getAttributesByName

      public Map<String,AbstractUserProfileBean.Attribute> getAttributesByName()
      Get map of all attributes where attribute name is key. Useful to render crafted form.
      Returns:
      map of attributes by name