Class SecurityProfileHelper


  • public class SecurityProfileHelper
    extends Object
    Helper for working with profiles.
    Since:
    8.0.0
    Author:
    XIMA Media GmbH
    • 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.