Class AbstractUserProfileBean
- java.lang.Object
-
- org.keycloak.forms.login.freemarker.model.AbstractUserProfileBean
-
- Direct Known Subclasses:
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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
AbstractUserProfileBean.Attribute
Info about user profile attribute available in Freemarker template.
-
Field Summary
Fields Modifier and Type Field Description protected List<AbstractUserProfileBean.Attribute>
attributes
protected Map<String,AbstractUserProfileBean.Attribute>
attributesByName
protected javax.ws.rs.core.MultivaluedMap<String,String>
formData
protected UserProfile
profile
-
Constructor Summary
Constructors Constructor Description AbstractUserProfileBean(javax.ws.rs.core.MultivaluedMap<String,String> formData)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract UserProfile
createUserProfile(UserProfileProvider provider)
Create UserProfile instance of the relevant type.protected abstract Stream<String>
getAttributeDefaultValues(String name)
Get attribute default values to be pre-filled into the form on first show.List<AbstractUserProfileBean.Attribute>
getAttributes()
All attributes to be shown in form sorted by the configured GUI order.Map<String,AbstractUserProfileBean.Attribute>
getAttributesByName()
Get map of all attributes where attribute name is key.abstract String
getContext()
Get context the template is used for, so view can be customized for distinct contexts.protected void
init(KeycloakSession session, boolean writeableOnly)
Subclass have to call this method at the end of constructor to init user profile data.
-
-
-
Field Detail
-
profile
protected UserProfile profile
-
attributes
protected List<AbstractUserProfileBean.Attribute> attributes
-
attributesByName
protected Map<String,AbstractUserProfileBean.Attribute> attributesByName
-
-
Method Detail
-
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 frominit(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
-
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
-
-