Class ProfileDefinition<P extends CommonProfile>
- java.lang.Object
-
- org.pac4j.core.profile.definition.ProfileDefinition<P>
-
- Direct Known Subclasses:
CommonProfileDefinition
public abstract class ProfileDefinition<P extends CommonProfile> extends 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
protected ProfileFactory<P>
newProfile
-
Constructor Summary
Constructors Constructor Description ProfileDefinition()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
convertAndAdd(CommonProfile profile, Map<String,Object> profileAttributes, Map<String,Object> authenticationAttributes)
Convert the profile and authentication attributes, if necessary, and add them to the profile.void
convertAndAdd(CommonProfile profile, AttributeLocation attributeLocation, String name, Object value)
Convert a profile or authentication attribute, if necessary, and add it to the profile.protected Map<String,AttributeConverter<? extends Object>>
getConverters()
List<String>
getPrimaryAttributes()
String
getProfileId()
List<String>
getSecondaryAttributes()
P
newProfile(Object... parameters)
Return the new built profile.protected void
primary(String name, AttributeConverter<? extends Object> converter)
Add an attribute as a primary one and its converter.protected void
secondary(String name, AttributeConverter<? extends Object> converter)
Add an attribute as a secondary one and its converter.protected void
setProfileFactory(ProfileFactory<P> profileFactory)
Define the way to build the profile.void
setProfileId(String profileId)
-
-
-
Field Detail
-
logger
protected final org.slf4j.Logger logger
-
newProfile
protected ProfileFactory<P extends CommonProfile> newProfile
-
-
Method Detail
-
newProfile
public P newProfile(Object... parameters)
Return the new built profile.- Parameters:
parameters
- some optional input parameters- Returns:
- the new built profile
-
convertAndAdd
public void convertAndAdd(CommonProfile profile, AttributeLocation attributeLocation, String name, 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(CommonProfile profile, Map<String,Object> profileAttributes, Map<String,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<P> profileFactory)
Define the way to build the profile.- Parameters:
profileFactory
- the way to build the profile
-
primary
protected void primary(String name, AttributeConverter<? extends Object> converter)
Add an attribute as a primary one and its converter.- Parameters:
name
- name of the attributeconverter
- converter
-
secondary
protected void secondary(String name, AttributeConverter<? extends Object> converter)
Add an attribute as a secondary one and its converter.- Parameters:
name
- name of the attributeconverter
- converter
-
getConverters
protected Map<String,AttributeConverter<? extends Object>> getConverters()
-
setProfileId
public void setProfileId(String profileId)
-
getProfileId
public String getProfileId()
-
-