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

public class CommonProfile extends BasicUserProfile
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:
  • 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

      public String getEmail()
      Return the email of the user.
      Returns:
      the email of the user
    • getFirstName

      public String getFirstName()
      Return the first name of the user.
      Returns:
      the first name of the user
    • getFamilyName

      public String getFamilyName()
      Return the family name of the user.
      Returns:
      the family name of the user
    • getDisplayName

      public String 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

      public String getUsername()
      Return the username of the user. It can be a login or a specific username.
      Specified by:
      getUsername in interface UserProfile
      Overrides:
      getUsername in class BasicUserProfile
      Returns:
      the username of the user
    • getGender

      public Gender getGender()
      Return the gender of the user.
      Returns:
      the gender of the user
    • getLocale

      public Locale getLocale()
      Return the locale of the user.
      Returns:
      the locale of the user
    • getPictureUrl

      public URI getPictureUrl()
      Return the url of the picture of the user.
      Returns:
      the url of the picture of the user.
    • getProfileUrl

      public URI getProfileUrl()
      Return the url of the profile of the user.
      Returns:
      the url of the profile of the user.
    • getLocation

      public String getLocation()
      Return the location of the user.
      Returns:
      the location of the user
    • isExpired

      public boolean isExpired()
      Specified by:
      isExpired in interface UserProfile
      Overrides:
      isExpired in class BasicUserProfile
    • getAttributeAsString

      protected String getAttributeAsString(String name)
    • getAttributeAsType

      protected <T> T getAttributeAsType(String name, Class<T> clazz, T defaultValue)
    • getAttributeAsDate

      protected Date getAttributeAsDate(String name)