Class Pac4jPrincipal

    • Constructor Detail

      • Pac4jPrincipal

        public Pac4jPrincipal​(List<org.pac4j.core.profile.UserProfile> profiles)
        Construct a Pac4jPrincipal. The principal name returned will be CommonProfile.getId().
        Parameters:
        profiles - A list containing all of the CommonProfiles created by Pac4j authorization.
      • Pac4jPrincipal

        public Pac4jPrincipal​(List<org.pac4j.core.profile.UserProfile> profiles,
                              String principalNameAttribute)
        Construct a Pac4jPrincipal and specify which attribute in the CommonProfile should be used for the principal name.
        Parameters:
        profiles - A list containing all of the CommonProfiles created by Pac4j authorization.
        principalNameAttribute - The attribute name in the CommonProfile that holds the principal name. A null or blank value means that CommonProfile.getId() should be used as the principal name.
    • Method Detail

      • getProfile

        public org.pac4j.core.profile.UserProfile getProfile()
        Get the main profile of the authenticated user.
        Returns:
        the main profile
      • getProfiles

        public List<org.pac4j.core.profile.UserProfile> getProfiles()
        Get all the profiles of the authenticated user.
        Returns:
        the list of profiles
      • getName

        public String getName()
        Returns a name for the principal based upon one of the attributes of the main CommonProfile. The attribute name used to query the CommonProfile is specified in the constructor.
        Specified by:
        getName in interface Principal
        Returns:
        a name for the Principal or null if the attribute is not populated.