Package de.xima.fc.security.helper
Class SecurityProfileHelper
- java.lang.Object
-
- de.xima.fc.security.helper.SecurityProfileHelper
-
public class SecurityProfileHelper extends Object
Helper for working with profiles.- Since:
- 8.0.0
- Author:
- XIMA Media GmbH
-
-
Field Summary
Fields Modifier and Type Field Description static String[]
DEFAULT_LDAP_USER_ATTRIBUTES
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addPicture(org.pac4j.core.profile.UserProfile pac4jProfile, UserProfile userProfile)
static UserIdentity
connectAccountBasedOnEmail(org.pac4j.core.profile.UserProfile profile)
Connects the user authentication (identity) provided by the given pac4j profile to an existing formcycle user profile account that has the same verified email address as the one provided by the pac4j profile.static UserProfile
createUserProfile(org.pac4j.core.profile.UserProfile pac4jProfile, Locale locale)
static IClientDescriptor
getAuthenticationClient(org.pac4j.core.profile.UserProfile profile)
static Set<IClientAuthorization>
getClientAuthorizations(org.pac4j.core.profile.UserProfile pac4jProfile)
static EGender
getGender(org.pac4j.core.profile.UserProfile profile)
static UserIdentity
getNewUserIdentity(org.pac4j.core.profile.UserProfile pac4jProfile)
static UserProfile
getNewUserProfile(org.pac4j.core.profile.UserProfile pac4jProfile)
static Set<String>
getPermissions(org.pac4j.core.profile.UserProfile pac4jProfile)
static byte[]
getPictureData(org.pac4j.core.profile.UserProfile pac4jProfile)
static URI
getPictureUri(org.pac4j.core.profile.UserProfile pac4jProfile)
static org.pac4j.core.profile.UserProfile
getSuperUserProfile()
static org.pac4j.core.profile.UserProfile
getSystemUserProfile(UserProfile userProfile)
static org.pac4j.core.profile.UserProfile
getTestUserProfile(DirectClientAuthorization authorization)
Creates an anonymous user profile for testing purposes (used in the CLOUD).static String
getUniversalReferenceId(org.pac4j.core.profile.UserProfile pac4jProfile)
static Optional<org.pac4j.core.profile.UserProfile>
getUserProfile(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, IAuthenticationTarget target)
static UserProfile
getUserProfile(org.pac4j.core.profile.UserProfile profile)
static boolean
isMultiFactorAuthenticated(IUser user)
static boolean
isMultiFactorAuthenticated(org.pac4j.core.profile.UserProfile pac4jProfile)
static boolean
isMultiFactorAuthenticationNeeded(IUser user)
static UserProfile
readUserProfileByVerifiedEmail(String emailAddress)
static void
refreshProfile(org.pac4j.core.profile.UserProfile pac4jProfile)
static void
saveProfileInSession(org.pac4j.core.profile.UserProfile profile, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, IAuthenticationTarget target)
static boolean
shouldReIssueVerificationLink(UserEmail userEmail)
-
-
-
Field Detail
-
DEFAULT_LDAP_USER_ATTRIBUTES
public static final String[] DEFAULT_LDAP_USER_ATTRIBUTES
-
-
Method Detail
-
isMultiFactorAuthenticationNeeded
public static boolean isMultiFactorAuthenticationNeeded(IUser user)
-
isMultiFactorAuthenticated
public static boolean isMultiFactorAuthenticated(IUser user)
-
isMultiFactorAuthenticated
public static boolean isMultiFactorAuthenticated(org.pac4j.core.profile.UserProfile pac4jProfile)
-
shouldReIssueVerificationLink
public static boolean shouldReIssueVerificationLink(UserEmail userEmail)
-
getUserProfile
public static Optional<org.pac4j.core.profile.UserProfile> getUserProfile(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, IAuthenticationTarget target)
-
getSuperUserProfile
public static org.pac4j.core.profile.UserProfile getSuperUserProfile()
-
getSystemUserProfile
public static org.pac4j.core.profile.UserProfile getSystemUserProfile(UserProfile userProfile)
-
getTestUserProfile
public static org.pac4j.core.profile.UserProfile getTestUserProfile(DirectClientAuthorization authorization)
Creates an anonymous user profile for testing purposes (used in the CLOUD). Users with this profile can test functionality within the client provided by the authorization. The access to the client is only granted for the time of the HTTP session.- Parameters:
authorization
- to allow testing for.- Returns:
- the newly created profile for testing purposes.
-
getNewUserProfile
public static UserProfile getNewUserProfile(org.pac4j.core.profile.UserProfile pac4jProfile)
-
getNewUserIdentity
public static UserIdentity getNewUserIdentity(org.pac4j.core.profile.UserProfile pac4jProfile)
-
getAuthenticationClient
public static IClientDescriptor getAuthenticationClient(org.pac4j.core.profile.UserProfile profile)
-
getGender
public static EGender getGender(org.pac4j.core.profile.UserProfile profile)
-
getPictureData
public static byte[] getPictureData(org.pac4j.core.profile.UserProfile pac4jProfile)
-
getPictureUri
public static URI getPictureUri(org.pac4j.core.profile.UserProfile pac4jProfile)
-
getUniversalReferenceId
public static String getUniversalReferenceId(org.pac4j.core.profile.UserProfile pac4jProfile)
-
getPermissions
public static Set<String> getPermissions(org.pac4j.core.profile.UserProfile pac4jProfile)
-
getClientAuthorizations
public static Set<IClientAuthorization> getClientAuthorizations(org.pac4j.core.profile.UserProfile pac4jProfile)
-
getUserProfile
public static UserProfile getUserProfile(org.pac4j.core.profile.UserProfile profile)
-
readUserProfileByVerifiedEmail
public static UserProfile readUserProfileByVerifiedEmail(String emailAddress)
-
createUserProfile
public static UserProfile createUserProfile(org.pac4j.core.profile.UserProfile pac4jProfile, Locale locale)
-
refreshProfile
public static void refreshProfile(org.pac4j.core.profile.UserProfile pac4jProfile)
-
saveProfileInSession
public static void saveProfileInSession(org.pac4j.core.profile.UserProfile profile, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, IAuthenticationTarget target)
-
addPicture
public static void addPicture(org.pac4j.core.profile.UserProfile pac4jProfile, UserProfile userProfile)
-
connectAccountBasedOnEmail
@Nullable public static UserIdentity connectAccountBasedOnEmail(org.pac4j.core.profile.UserProfile profile)
Connects the user authentication (identity) provided by the given pac4j profile to an existing formcycle user profile account that has the same verified email address as the one provided by the pac4j profile.- Parameters:
profile
- to be connected to an existing formcycle user profile based on the email address.- Returns:
- the user identity that has been created if the account could be connected to an existing user profile and
null
otherwise.
-
-