Class ProfileDefinition
- java.lang.Object
-
- org.pac4j.core.profile.definition.ProfileDefinition
-
- Direct Known Subclasses:
CommonProfileDefinition
public abstract class ProfileDefinition extends java.lang.Object
Define a profile (its class and attributes).- Since:
- 2.0.0
- Author:
- Jerome Leleu
-
-
Field Summary
Fields Modifier and Type Field Description protected org.slf4j.Logger
logger
-
Constructor Summary
Constructors Constructor Description ProfileDefinition()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
convertAndAdd(UserProfile profile, java.util.Map<java.lang.String,java.lang.Object> profileAttributes, java.util.Map<java.lang.String,java.lang.Object> authenticationAttributes)
Convert the profile and authentication attributes, if necessary, and add them to the profile.void
convertAndAdd(UserProfile profile, AttributeLocation attributeLocation, java.lang.String name, java.lang.Object value)
Convert a profile or authentication attribute, if necessary, and add it to the profile.java.util.Map<java.lang.String,AttributeConverter>
getConverters()
protected java.lang.Object
getParameter(java.lang.Object[] parameters, int num)
java.util.List<java.lang.String>
getPrimaryAttributes()
java.lang.String
getProfileId()
java.util.List<java.lang.String>
getSecondaryAttributes()
boolean
isRestoreProfileFromTypedId()
UserProfile
newProfile(java.lang.Object... parameters)
Return the new built or restored profile.protected void
primary(java.lang.String name, AttributeConverter converter)
Add an attribute as a primary one and its converter.protected void
secondary(java.lang.String name, AttributeConverter converter)
Add an attribute as a secondary one and its converter.protected void
setProfileFactory(ProfileFactory profileFactory)
Define the way to build the profile.void
setProfileId(java.lang.String profileId)
void
setRestoreProfileFromTypedId(boolean restoreProfileFromTypedId)
-
-
-
Method Detail
-
newProfile
public UserProfile newProfile(java.lang.Object... parameters)
Return the new built or restored profile.- Parameters:
parameters
- some input parameters (the first optional one is the typed id)- Returns:
- the new built or restored profile
-
getParameter
protected java.lang.Object getParameter(java.lang.Object[] parameters, int num)
-
convertAndAdd
public void convertAndAdd(UserProfile profile, AttributeLocation attributeLocation, java.lang.String name, java.lang.Object value)
Convert a profile or authentication attribute, if necessary, and add it to the profile.- Parameters:
profile
- The profile.attributeLocation
- Location of the attribute inside the profile: classic profile attribute, authentication attribute, ...name
- The attribute name.value
- The attribute value.
-
convertAndAdd
public void convertAndAdd(UserProfile profile, java.util.Map<java.lang.String,java.lang.Object> profileAttributes, java.util.Map<java.lang.String,java.lang.Object> authenticationAttributes)
Convert the profile and authentication attributes, if necessary, and add them to the profile.- Parameters:
profile
- The profile.profileAttributes
- The profile attributes. May benull
.authenticationAttributes
- The authentication attributes. May benull
.
-
setProfileFactory
protected void setProfileFactory(ProfileFactory profileFactory)
Define the way to build the profile.- Parameters:
profileFactory
- the way to build the profile
-
primary
protected void primary(java.lang.String name, AttributeConverter converter)
Add an attribute as a primary one and its converter.- Parameters:
name
- name of the attributeconverter
- converter
-
secondary
protected void secondary(java.lang.String name, AttributeConverter converter)
Add an attribute as a secondary one and its converter.- Parameters:
name
- name of the attributeconverter
- converter
-
getPrimaryAttributes
public java.util.List<java.lang.String> getPrimaryAttributes()
-
getSecondaryAttributes
public java.util.List<java.lang.String> getSecondaryAttributes()
-
getConverters
public java.util.Map<java.lang.String,AttributeConverter> getConverters()
-
setProfileId
public void setProfileId(java.lang.String profileId)
-
getProfileId
public java.lang.String getProfileId()
-
isRestoreProfileFromTypedId
public boolean isRestoreProfileFromTypedId()
-
setRestoreProfileFromTypedId
public void setRestoreProfileFromTypedId(boolean restoreProfileFromTypedId)
-
-