Class ProfileHelper

java.lang.Object
org.pac4j.core.profile.ProfileHelper

public final class ProfileHelper extends Object
This class is an helper for profiles.
Since:
1.1.0
Author:
Jerome Leleu
  • Method Details

    • isTypedIdOf

      public static boolean isTypedIdOf(String id, Class<? extends UserProfile> clazz)
      Indicate if the user identifier matches this kind of profile.
      Parameters:
      id - user identifier
      clazz - profile class
      Returns:
      if the user identifier matches this kind of profile
    • buildUserProfileByClassCompleteName

      public static UserProfile buildUserProfileByClassCompleteName(String completeName)
      Build a profile by its class name.
      Parameters:
      completeName - the class name
      Returns:
      the built user profile
    • flatIntoOneProfile

      public static <U extends UserProfile> Optional<U> flatIntoOneProfile(Collection<U> profiles)
      Flat the list of profiles into a single optional profile (skip any anonymous profile unless it's the only one).
      Type Parameters:
      U - the kind of profile
      Parameters:
      profiles - the list of profiles
      Returns:
      the (optional) profile
    • flatIntoAProfileList

      public static <U extends UserProfile> List<U> flatIntoAProfileList(Map<String,U> profiles)
      Flat the map of profiles into a list of profiles.
      Type Parameters:
      U - the kind of profile
      Parameters:
      profiles - the map of profiles
      Returns:
      the list of profiles
    • sanitizeIdentifier

      public static String sanitizeIdentifier(Object id)
      Sanitize into a string identifier.
      Parameters:
      id - the identifier object
      Returns:
      the sanitized identifier
    • getProfileClassPrefixes

      public static List<String> getProfileClassPrefixes()
    • setProfileClassPrefixes

      public static void setProfileClassPrefixes(List<String> profileClassPrefixes)