Class Pac4jUtils

java.lang.Object
de.xima.fc.utils.Pac4jUtils

public class Pac4jUtils extends Object
Utility class for working with pac4j.
Since:
8.0.0
Author:
XIMA Media GmbH
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.pac4j.core.profile.UserProfile
    Converts / casts the given session attribute object into a pac4j user profile.
    static IUser
    getUser(javax.servlet.http.HttpSession session)
    Finds the user within the session data and returns it if present.
    static org.pac4j.core.profile.UserProfile
    getUserProfile(javax.servlet.http.HttpSession session)
    Finds the pac4j user profile within the session data and returns it if present.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getUser

      public static IUser getUser(javax.servlet.http.HttpSession session)
      Finds the user within the session data and returns it if present.
      Parameters:
      session - the user is saved in.
      Returns:
      the user if it is present in the session data.
    • getUserProfile

      public static org.pac4j.core.profile.UserProfile getUserProfile(javax.servlet.http.HttpSession session)
      Finds the pac4j user profile within the session data and returns it if present.
      Parameters:
      session - the pac4j user profile is saved in.
      Returns:
      the pac4j user profile if it is present in the session data.
    • convertSessionAttributeToUserProfile

      public static org.pac4j.core.profile.UserProfile convertSessionAttributeToUserProfile(Object sessionAttribute)
      Converts / casts the given session attribute object into a pac4j user profile. This method expects a user profile value from a session as it is saved by pac4j. By default pac4j will save user profiles with the key pac4jUserProfiles in a given session.
      Parameters:
      sessionAttribute - that is expected to be a pac4j user profile session attribute value.
      Returns:
      the converted user profile or null if no conversion was possible;