Package org.pac4j.core.profile
Class CommonProfile
java.lang.Object
org.pac4j.core.profile.BasicUserProfile
org.pac4j.core.profile.CommonProfile
- All Implemented Interfaces:
Externalizable
,Serializable
,UserProfile
- Direct Known Subclasses:
AbstractJwtProfile
,AnonymousProfile
This class is the base implementation with the default attribute getters which can be retrieved for most profiles.
- Since:
- 1.3.0
- Author:
- Jerome Leleu
- See Also:
-
Field Summary
Fields inherited from class org.pac4j.core.profile.BasicUserProfile
logger
-
Constructor Summary
ConstructorDescriptionCommonProfile
(boolean canMergeAttributes) Create a profile with possibility to merge attributes with the same name and collection-type values -
Method Summary
Modifier and TypeMethodDescriptionprotected Date
getAttributeAsDate
(String name) protected String
getAttributeAsString
(String name) protected <T> T
getAttributeAsType
(String name, Class<T> clazz, T defaultValue) Return the displayed name of the user.getEmail()
Return the email of the user.Return the family name of the user.Return the first name of the user.Return the gender of the user.Return the locale of the user.Return the location of the user.Return the url of the picture of the user.Return the url of the profile of the user.Return the username of the user.boolean
Methods inherited from class org.pac4j.core.profile.BasicUserProfile
addAttribute, addAttributes, addAuthenticationAttribute, addAuthenticationAttributes, addRole, addRoles, asPrincipal, build, build, containsAttribute, containsAuthenicationAttribute, extractAttributeValues, getAttribute, getAttribute, getAttributes, getAuthenticationAttribute, getAuthenticationAttribute, getAuthenticationAttributes, getRoles, getTypedId, readExternal, removeAttribute, removeAuthenticationAttribute, removeLoginData, setId, setRoles, writeExternal
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.pac4j.core.profile.UserProfile
getClientName, getId, getLinkedId, isRemembered, setClientName, setLinkedId, setRemembered
-
Constructor Details
-
CommonProfile
public CommonProfile() -
CommonProfile
public CommonProfile(boolean canMergeAttributes) Create a profile with possibility to merge attributes with the same name and collection-type values- Parameters:
canMergeAttributes
- if true - merge attributes with the same name and collection-type values, if false - overwrite them- Since:
- 3.1.0
-
-
Method Details
-
getEmail
Return the email of the user.- Returns:
- the email of the user
-
getFirstName
Return the first name of the user.- Returns:
- the first name of the user
-
getFamilyName
Return the family name of the user.- Returns:
- the family name of the user
-
getDisplayName
Return the displayed name of the user. It can be the username or the first and last names (separated by a space).- Returns:
- the displayed name of the user
-
getUsername
Return the username of the user. It can be a login or a specific username.- Specified by:
getUsername
in interfaceUserProfile
- Overrides:
getUsername
in classBasicUserProfile
- Returns:
- the username of the user
-
getGender
Return the gender of the user.- Returns:
- the gender of the user
-
getLocale
Return the locale of the user.- Returns:
- the locale of the user
-
getPictureUrl
Return the url of the picture of the user.- Returns:
- the url of the picture of the user.
-
getProfileUrl
Return the url of the profile of the user.- Returns:
- the url of the profile of the user.
-
getLocation
Return the location of the user.- Returns:
- the location of the user
-
isExpired
public boolean isExpired()- Specified by:
isExpired
in interfaceUserProfile
- Overrides:
isExpired
in classBasicUserProfile
-
getAttributeAsString
-
getAttributeAsType
-
getAttributeAsDate
-