Package de.xima.fc.utils
Class Pac4jUtils
- java.lang.Object
-
- de.xima.fc.utils.Pac4jUtils
-
public class Pac4jUtils extends Object
Utility class for working withpac4j
.- Since:
- 8.0.0
- Author:
- XIMA Media GmbH
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.pac4j.core.profile.UserProfile
convertSessionAttributeToUserProfile(Object sessionAttribute)
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.
-
-
-
Method Detail
-
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 bypac4j
. By defaultpac4j
will save user profiles with the keypac4jUserProfiles
in a given session.- Parameters:
sessionAttribute
- that is expected to be apac4j
user profile session attribute value.- Returns:
- the converted user profile or null if no conversion was possible;
-
-