Package de.xima.fc.utils
Class UserMgmtUtils
java.lang.Object
de.xima.fc.utils.UserMgmtUtils
- All Implemented Interfaces:
Serializable
Hilfsklasse für Funktionalitäten der Benutzerverwaltung.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BenutzerDeprecated.static final Stringstatic final BenutzerDeprecated.Usevirtual usersstatic final BenutzerDeprecated.Usevirtual usersstatic final BenutzerDeprecated.No equivalent, but seeVirtualUserstatic final BenutzerDeprecated.static final BenutzerDeprecated. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancanAccessClient(IUser user, Mandant client) Whether the given user has permission to access the given client.static booleancanAccessInbox(IUser user, Postfach inbox) Whether the user has permission to access the client inbox.static booleancanEditProject(IUser user, Projekt project) Whether or not the given user has permission to edit the given project.static booleancanViewProject(IUser user, Projekt project) Whether the given user has permission to view the given project.static booleancheckPassword(String clearTextPassword, String encryptedPassword) static org.pac4j.core.profile.GenderConverts the given gender to a pac4jGenderand toGender.UNSPECIFIEDif no match was found ornull.static EGenderconvert(org.pac4j.core.profile.Gender gender) static org.pac4j.core.profile.CommonProfileconvertToProfile(Benutzer user) Deprecated.static StringdfltBgNameFor(ERollenTyp rolle, Locale locale) Deprecated.Is handled inIClientCreateDatastatic StringDeprecated.static List<org.passay.CharacterRule>filterCharacterRules(List<org.passay.Rule> rules) static org.passay.LengthRulefilterFirstLengthRules(List<org.passay.Rule> rules) static StringgenPwd()Deprecated.usegenPwd(List)insteadstatic StringgenPwd(List<SystemProperty> pwdPolicyConfig) Generates a password based on the configured system rulesstatic IClientDescriptorgetAuthenticationClientFromAuthenticationAttribute(org.pac4j.core.profile.UserProfile pac4jProfile) Gets the client descriptor of the client that authenticated the user if it has been set in the authentication attributes of the given profile.static StringgetAuthenticationTargetFromAuthenticationAttribute(org.pac4j.core.profile.UserProfile pac4jProfile) Gets the target that the user authenticated for if it has been set in the authentication attributes of the given profile.static BenutzergetBenutzerFromUser(IUser user, Mandant client) Deprecated.static Set<IClientAuthorization>getClientAuthorizationsFromAuthenticationAttribute(org.pac4j.core.profile.UserProfile pac4jProfile) Get the client authorizations of the user if it has been set in the authentication attributes of the given profile.static StringgetClientPermission(Mandant client, IAccessProperty accessProperty) Returns a string value representing the permission within a client (Mandant).static StringgetClientPermission(Mandant client, String permissionName) Returns a string value representing the permission within aclient.static StringgetClientRole(Mandant client, String roleName) Returns a string value representing the role within a client (Mandant).static StringgetClientRole(Rolle role) Returns a string value representing the role within a client (Mandant).static List<org.passay.Rule>This method returns a password policy with strict rules for the super user.static BenutzergetFromProfile(org.pac4j.core.profile.CommonProfile profile) Deprecated.static StringgetGeneralPermission(IAccessProperty accessProperty) Returns a string value representing the permission for the general scope.static StringgetGeneralPermission(String permissionName) Returns a string value representing the permission for the general scope.static DirectClientAuthorizationgetInvitationClientAuthorizationFromAuthenticationAttribute(org.pac4j.core.profile.UserProfile pac4jProfile) Gets the invitation client authorization if it has been set in the authentication attributes of the given pac4j profile.static StringgetMaskedEmailAddress(String email) Masks the email address for privacy purposes.static StringgetMaskedName(String name) Masks the user name for privacy purposes.static StringgetMaskedUserAttribute(String value) Masks the given user attribute (e.g.static List<org.passay.Rule>getPasswordRules(List<SystemProperty> pwdPolicyConfig, boolean useDefaultForGen) Determines the password policy rules set from the persisted system configuration.static intgetPasswordStrength(String newPassword, List<org.passay.Rule> rules) Calculates the password-strength for password ui components.getPermissionsFromAuthenticationAttribute(org.pac4j.core.profile.UserProfile pac4jProfile) Gets the permissions if they have been set in the authentication attributes of the given pac4j profile.static com.alibaba.fastjson.JSONObjectgetRawData(org.pac4j.core.profile.UserProfile userProfile) static StringgetSystemPermission(IAccessProperty accessProperty) Returns a string value representing the permission forsystemscope.static StringgetSystemPermission(String permissionName) Returns a string value representing the permission forsystemscope.static longgetTimeStamp(long addHours, long addMinutes) Deprecated.Token duration for password set/reset mails is handled in UserMailUtil.static StringgetUniversalReferenceId(IUserIdentity identity) Returns the universal reference ID of the user.static StringgetUniversalReferenceId(EHashAlgorithm hashAlgorithm, IUserIdentity identity) Returns the universal reference ID of the user using the given hash algorithm.static StringgetUniversalReferenceId(EHashAlgorithm hashAlgorithm, String clientName, String profileId) Returns the universal reference ID of the user.static StringgetUniversalReferenceId(EHashAlgorithm hashAlgorithm, org.pac4j.core.profile.UserProfile profile) Returns the universal reference ID of the user.static StringgetUniversalReferenceId(org.pac4j.core.profile.UserProfile profile) Returns the universal reference ID of the user.static StringgetUniversalReferenceIdClientPrefix(IClientDescriptor descriptor) Returns the prefix of the authentication client for creating the universal reference ID for a user.static StringgetUniversalReferenceIdClientPrefix(String clientName) Returns the prefix of the authentication client for creating the universal reference ID for a user.static UserProfilegetUserProfileFromAuthenticationAttribute(org.pac4j.core.profile.UserProfile pac4jProfile) Gets the formcycle profile if it has been set in the authentication attributes of the given pac4j profile.static StringgetUserProfileHash(EHashAlgorithm hashAlgorithm, String clientName, String profileId) Calculates the hash digest for the user profile defined by the given client name and profile ID using the given hash algorithm.static StringgetUserProfileHash(EHashAlgorithm hashAlgorithm, org.pac4j.core.profile.UserProfile profile) Calculates the hash digest for the given user profile using the given hash algorithm.static booleanhasBackendAccess(IClientAuthorization authorization) If the given client authorization grants users access to the formcycle backend.static booleanhasBackendAccess(IUser user) Checks if the user has permission to access to the formcycle backend.static booleanhasDesignerAccess(IClientAuthorization authorization) Returns whether or not the given client authorization grants designer access.static StringhashPassword(String clearTextPassword) Paswort-Encryption.static booleanhasInboxAccess(IClientAuthorization authorization) Returns whether or not the given client authorization grants inbox access.static booleanisActive(IClientAuthorization authorization) Checks if the given client authorization is active.static booleanisAnonymousUser(Benutzer user) Deprecated.static booleanisAnonymousUser(IUser user) Checks if the user is anonymous.static booleanisAuthenticatedFor(IUser user, String authTarget) checks if the user has been authenticated for the given authentication target.static booleanisBackendAccessCapable(IClientAuthorization authorization) Returns if the given client authorization is capable of allowing users access to the formcycle backend.static booleanisClientAdmin(UserProfile profile, Mandant client) Returns true if given profile has a role of a MANDANT_ADMINstatic booleanisClientAdmin(IClientAuthorization authorization) Returns true if given authorization has a role of a MANDANT_ADMINstatic booleanisClientAdmin(IUser user, Mandant client) Checks if the user is an admin of the given client.static booleanisExpired(IEntityClientAuthorization authorization) Checks if the given client authorization is expired (right now).static booleanisExternalUser(Benutzer user) Deprecated.static booleanisInternalUser(Benutzer user) Deprecated.Not neede anymore.static booleanisInvitationExpired(IEntityClientAuthorization authorization) Checks if the invitation attached to the given client authorization is expired (right now).static booleanisInvitedUser(IUser user) static booleanisInvitedUser(org.pac4j.core.profile.UserProfile pac4jProfile) static booleanisSetupUser(Benutzer user) Deprecated.UseisSuperUser(IUser)instead.static booleanisSetupUserWithClient(Benutzer user, javax.servlet.http.HttpSession session) Deprecated.static booleanisSetupUserWithoutClient(Benutzer user, javax.servlet.http.HttpSession session) Deprecated.static booleanisSuperUser(IUser user) Checks if the user is THE super user.static booleanisSystemAdmin(UserProfile profile) Checks if the user of the given profile is a system admin.static booleanisSystemAdmin(IUser user) Checks if the user is a system admin.static booleanisSystemUser(Benutzer user) Deprecated.Not needed anymore.static booleanisUser(IEntityClientAuthorization authorization, IUser user) Checks whether the given client authorization applies to the given user.static booleanisUser(IUserIdentity identity, IUser user) Checks whether the given user identity is the identity of the given user.static booleanisUser(UserProfile profile, IUser user) Checks whether the given user profile is the user profile of the given user.static org.pac4j.core.profile.AnonymousProfilestatic voidsetAuthenticationTargetInAuthenticationAttributes(org.pac4j.core.profile.UserProfile pac4jProfile, IAuthenticationTarget target) Sets the given authentication target in the authentication attributes of the profile.static com.alibaba.fastjson.JSONObjectstatic com.alibaba.fastjson.JSONObjectstatic com.alibaba.fastjson.JSONObjecttoJSON(Benutzer user, List<BenutzerGruppe> userGroups) Deprecated.UsetoJson(IUser, Mandant)instead.static com.alibaba.fastjson.JSONObjecttoJSON(Benutzer user, List<BenutzerGruppe> userGroups, org.pac4j.core.profile.CommonProfile prof) Deprecated.UsetoJson(IUser, Mandant)instead.static PasswordValidationResultvalidateDefaultPasswordRules(String password) Validates the password with the default password rules.static PasswordValidationResultvalidatePassword(String userName, String oldPassword, String newPassword, List<SystemProperty> systemConfig) Validates Passwordsstatic PasswordValidationResultvalidatePassword(String oldPassword, String newPassword, List<SystemProperty> systemConfig) Validates Passwordsstatic PasswordValidationResultvalidatePassword(String password, List<SystemProperty> systemConfig) Validates Passwords
-
Field Details
-
DEFAULT_PWD_SYMBOLS
- See Also:
-
ANONYMOUS
Deprecated.Virtueller Benutzer für Fälle, bei denen ein Benutzer benötigt wird, aber keine Anmeldungen notwendig ist. -
SYSTEM
Deprecated.Virtueller Benutzer für Fälle, bei denen ein Benutzer benötigt wird, aber keine Anmeldungen notwendig ist. -
SETUP
Deprecated.Virtueller Benutzer für Fälle, bei denen ein Benutzer benötigt wird, aber keine Anmeldungen notwendig ist. -
DESIGNER_USER
Deprecated.No equivalent, but seeVirtualUserVirtueller Benutzer für Fälle, bei denen ein Benutzer benötigt wird, aber keine Anmeldungen notwendig ist. -
DESIGNER_LAST_DUMMY
Deprecated.Usevirtual usersVirtueller Benutzer für Fälle, bei denen ein Benutzer benötigt wird, aber keine Anmeldungen notwendig ist. -
DESIGNER_INITIAL_DUMMY
Deprecated.Usevirtual usersVirtueller Benutzer für Fälle, bei denen ein Benutzer benötigt wird, aber keine Anmeldungen notwendig ist.
-
-
Method Details
-
canEditProject
Whether or not the given user has permission to edit the given project.- Parameters:
user- to check forproject- to check- Returns:
trueif the user has permission to edit the project andfalseotherwise.
-
canViewProject
Whether the given user has permission to view the given project.- Parameters:
user- to check forproject- to check- Returns:
trueif the user has permission to view the project andfalseotherwise.
-
canAccessClient
Whether the given user has permission to access the given client.- Parameters:
user- to check forclient- to check- Returns:
trueif the user has permission to access the given client andfalseotherwise.
-
canAccessInbox
Whether the user has permission to access the client inbox. Note: This check does not take into account whether the user has therole permission to access the inbox UI.- Parameters:
user- to check forinbox- to check- Returns:
trueif the user has permission to access the given client inbox andfalseotherwise.
-
isClientAdmin
Returns true if given profile has a role of a MANDANT_ADMIN- Parameters:
profile- to check- Returns:
- false if no admin role found
-
isClientAdmin
Returns true if given authorization has a role of a MANDANT_ADMIN- Parameters:
authorization- direct or indirect authorization- Returns:
- false if no admin role found
-
isClientAdmin
Checks if the user is an admin of the given client.- Parameters:
user- to check forclient- to check- Returns:
trueif the user is an admin of the given client andfalseotherwise.
-
isSystemAdmin
Checks if the user of the given profile is a system admin. System admins have permission to access/edit the system settings.- Parameters:
profile- to check- Returns:
trueif the user of the given profile is a system admin andfalseotherwise.
-
isSystemAdmin
Checks if the user is a system admin. System admins have permission to access/edit the system settings.- Parameters:
user- A user to check.- Returns:
trueif the user is a system admin andfalseotherwise.
-
isSuperUser
Checks if the user is THE super user. There is only one super user (sadmin) in the system.- Parameters:
user- to check- Returns:
trueif the given user is the super user andfalseotherwise.
-
isAnonymousUser
Checks if the user is anonymous.- Parameters:
user- to check- Returns:
trueif the user is an anonymous user andfalseotherwise.
-
isBackendAccessCapable
Returns if the given client authorization is capable of allowing users access to the formcycle backend. This does not mean that the authorization actually allows backend access. If you want to find if an authorization grants backend access usehasBackendAccess(IClientAuthorization)instead.- Parameters:
authorization- to check.- Returns:
trueif the authorization is capable of allowing users access to the formcycle backend.falseotherwise.
-
isUser
Checks whether the given client authorization applies to the given user.- Parameters:
authorization- to check.user- to check if the client authorization applies.- Returns:
trueif the given client authorization applies to the given user andfalseotherwise.
-
isUser
Checks whether the given user profile is the user profile of the given user.- Parameters:
profile- to check.user- to check if the user profile is their user profile.- Returns:
trueif the given user profile is the user profile of the given user andfalseotherwise.
-
isUser
Checks whether the given user identity is the identity of the given user.- Parameters:
identity- to check.user- to check if their identity is the given user identity.- Returns:
trueif the given user identity is the identity of the given user andfalseotherwise.
-
isActive
Checks if the given client authorization is active. If the attached user profile is inactive then the client authorization can't be active.- Parameters:
authorization- to check.- Returns:
trueif the given client authorization is active andfalseotherwise.
-
isExpired
Checks if the given client authorization is expired (right now).- Parameters:
authorization- to check.- Returns:
trueif the given client authorization is expired andfalseotherwise.
-
isInvitationExpired
Checks if the invitation attached to the given client authorization is expired (right now).- Parameters:
authorization- to check.- Returns:
trueif the invitation to the given client authorization is expired andfalseotherwise.
-
isAuthenticatedFor
checks if the user has been authenticated for the given authentication target.- Parameters:
user- to check.authTarget- to check. User can authenticated for different authentication targets, e.g. "backend", "form", ...- Returns:
trueif the user has been authenticated for the given authentication target andfalseotherwise.- Throws:
IllegalArgumentException- if a blank authentication target is given.
-
isInvitedUser
-
isInvitedUser
public static boolean isInvitedUser(org.pac4j.core.profile.UserProfile pac4jProfile) -
hasBackendAccess
Checks if the user has permission to access to the formcycle backend.- Parameters:
user- to check- Returns:
trueif the user has permission to access the formcycle backend andfalseotherwise.
-
hasBackendAccess
If the given client authorization grants users access to the formcycle backend.- Parameters:
authorization- to check- Returns:
trueif the client authorization grants users access to the formcycle backend andfalseotherwise.
-
hasInboxAccess
Returns whether or not the given client authorization grants inbox access.- Parameters:
authorization- to check- Returns:
trueif the authorization grants inbox access andfalseotherwise.
-
hasDesignerAccess
Returns whether or not the given client authorization grants designer access.- Parameters:
authorization- to check- Returns:
trueif the authorization grants designer access andfalseotherwise.
-
setAuthenticationTargetInAuthenticationAttributes
public static void setAuthenticationTargetInAuthenticationAttributes(org.pac4j.core.profile.UserProfile pac4jProfile, IAuthenticationTarget target) Sets the given authentication target in the authentication attributes of the profile.- Parameters:
pac4jProfile- to set authentication target for.target- to set.
-
getAuthenticationTargetFromAuthenticationAttribute
public static String getAuthenticationTargetFromAuthenticationAttribute(org.pac4j.core.profile.UserProfile pac4jProfile) Gets the target that the user authenticated for if it has been set in the authentication attributes of the given profile.- Parameters:
pac4jProfile- to get the authentication client descriptor for- Returns:
- the authentication client descriptor if it has been set and
nullotherwise.
-
getAuthenticationClientFromAuthenticationAttribute
public static IClientDescriptor getAuthenticationClientFromAuthenticationAttribute(org.pac4j.core.profile.UserProfile pac4jProfile) Gets the client descriptor of the client that authenticated the user if it has been set in the authentication attributes of the given profile.- Parameters:
pac4jProfile- to get the authentication client descriptor for- Returns:
- the authentication client descriptor if it has been set and
nullotherwise.
-
getClientAuthorizationsFromAuthenticationAttribute
public static Set<IClientAuthorization> getClientAuthorizationsFromAuthenticationAttribute(org.pac4j.core.profile.UserProfile pac4jProfile) Get the client authorizations of the user if it has been set in the authentication attributes of the given profile.- Parameters:
pac4jProfile- to get the client authorizations for.- Returns:
- the client authorizations if it has been set and
nullotherwise.
-
getUserProfileFromAuthenticationAttribute
public static UserProfile getUserProfileFromAuthenticationAttribute(org.pac4j.core.profile.UserProfile pac4jProfile) Gets the formcycle profile if it has been set in the authentication attributes of the given pac4j profile.- Parameters:
pac4jProfile- to get the formcycle profile for- Returns:
- the formcycle profile if it has been set and
nullotherwise.
-
getPermissionsFromAuthenticationAttribute
public static Set<String> getPermissionsFromAuthenticationAttribute(org.pac4j.core.profile.UserProfile pac4jProfile) Gets the permissions if they have been set in the authentication attributes of the given pac4j profile.- Parameters:
pac4jProfile- to get the permissions for.- Returns:
- the permissions if they have been set in and
nullotherwise.
-
getInvitationClientAuthorizationFromAuthenticationAttribute
public static DirectClientAuthorization getInvitationClientAuthorizationFromAuthenticationAttribute(org.pac4j.core.profile.UserProfile pac4jProfile) Gets the invitation client authorization if it has been set in the authentication attributes of the given pac4j profile. Seeherefor more information about what invitation client authorizations are used for.- Parameters:
pac4jProfile- to get the invitation client authorization for.- Returns:
- the invitation client authorization if it has been set in and
nullotherwise. - See Also:
-
getUniversalReferenceId
Returns the universal reference ID of the user. The universal reference ID is unique for every user within the system across all authenticators if it is a uniquely identifiable user. SeegetUniversalReferenceId(EHashAlgorithm, String, String)for universal reference ID format.- Parameters:
profile- to get the universal reference ID for- Returns:
- the universal reference ID of the profile.
-
getUniversalReferenceId
public static String getUniversalReferenceId(EHashAlgorithm hashAlgorithm, org.pac4j.core.profile.UserProfile profile) Returns the universal reference ID of the user. The universal reference ID is unique for every user within the system across all authenticators if it is a uniquely identifiable user. SeegetUniversalReferenceId(EHashAlgorithm, String, String)for universal reference ID format.- Parameters:
hashAlgorithm- the algorithm to be used for calculating the hash digest for a user profile. If no hash algorithm is given, thedefault user profile hash algorithmwill be used.profile- to get the universal reference ID for- Returns:
- the universal reference ID of the profile.
-
getUniversalReferenceId
Returns the universal reference ID of the user. The universal reference ID is unique for every user within the system across all authenticators if it is a uniquely identifiable user. SeegetUniversalReferenceId(EHashAlgorithm, String, String)for universal reference ID format.- Parameters:
identity- to get the universal reference ID for- Returns:
- the universal reference ID of the identity.
-
getUniversalReferenceId
Returns the universal reference ID of the user using the given hash algorithm. The universal reference ID is unique for every user within the system across all authenticators if it is a uniquely identifiable user. SeegetUniversalReferenceId(EHashAlgorithm, String, String)for universal reference ID format.- Parameters:
hashAlgorithm- the algorithm to be used for calculating the hash digest for a user profile. If no hash algorithm is given, thedefault user profile hash algorithmwill be used.identity- to get the universal reference ID for- Returns:
- the universal reference ID of the identity.
-
getUniversalReferenceId
public static String getUniversalReferenceId(EHashAlgorithm hashAlgorithm, String clientName, String profileId) Returns the universal reference ID of the user. The universal reference ID is unique for every user within the system across all authenticators if it is a uniquely identifiable user. Anonymous users or users that authenticate via a group password can't be uniquely identified. There are a few users which have special universal reference IDs (see below). All other users follow a general format for their universal reference ID.Universal reference ID format for general users:
<
Authenticator client name>#<Hash algorithm ID>#<profile identification hash>- Authenticator client name
- The client name of an authenticator client, which can be retrieved by calling
IClientDescriptor.getClientName(), E.g. "KERBEROS" or the callback UUID for entity authenticators. - Hash algorithm ID
- An identifier determining the hash algorithm used to calculate the profile hash
- Profile identification hash
- A hash digest representing the user profile. See
getUserProfileHash(EHashAlgorithm, UserProfile)for the creation of the user profile hash.
- Parameters:
hashAlgorithm- the algorithm to be used for calculating the hash digest for a user profile. If no hash algorithm is given, thedefault user profile hash algorithmwill be used.clientName- describes the authentication client that is used to authenticate the userprofileId- ID of the authenticated user within the authentication client- Returns:
- the universal reference ID of the user
-
getUniversalReferenceIdClientPrefix
Returns the prefix of the authentication client for creating the universal reference ID for a user. SeegetUniversalReferenceId(EHashAlgorithm, String, String)for universal reference ID format.- Parameters:
descriptor- describes the authentication client that is used to authenticate the user.- Returns:
- the prefix of the authentication client for creating the universal reference ID for a user.
-
getUniversalReferenceIdClientPrefix
Returns the prefix of the authentication client for creating the universal reference ID for a user. SeegetUniversalReferenceId(EHashAlgorithm, String, String)for universal reference ID format.- Parameters:
clientName- describes the authentication client that is used to authenticate the user.- Returns:
- the prefix of the authentication client for creating the universal reference ID for a user.
-
getUserProfileHash
public static String getUserProfileHash(EHashAlgorithm hashAlgorithm, org.pac4j.core.profile.UserProfile profile) Calculates the hash digest for the given user profile using the given hash algorithm.- Parameters:
hashAlgorithm- the algorithm to be used for calculating the hash digest for a user profile. If no hash algorithm is given, thedefault user profile hash algorithmwill be used.profile- the user profile to be hashed.- Returns:
- the hash digest for the user profile.
- Throws:
NullPointerException- if no user profile was given.
-
getUserProfileHash
public static String getUserProfileHash(EHashAlgorithm hashAlgorithm, String clientName, String profileId) Calculates the hash digest for the user profile defined by the given client name and profile ID using the given hash algorithm.- Parameters:
hashAlgorithm- the algorithm to be used for calculating the hash digest for a user profile. If no hash algorithm is given, thedefault user profile hash algorithmwill be used.clientName- the client name of the authenticator (the authenticator callback UUID for entity authenticators).profileId- the ID of the user profile within an IDP.- Returns:
- the hash digest for the user profile defined by the client name and profile ID.
- Throws:
IllegalArgumentException- if no client name or profile ID were given.
-
getClientRole
Returns a string value representing the role within a client (Mandant). For more information about the format of the scoped role value seegetClientRole(Mandant, String).- Parameters:
role- to get the scoped role value for- Returns:
- a scoped string value representing the role within a client.
-
getClientRole
Returns a string value representing the role within a client (Mandant). Format of the string value:<client UUID>#<Role name>
- Parameters:
client- to scope role name toroleName- to scope- Returns:
- a scoped string value representing the role within a client.
-
getClientPermission
Returns a string value representing the permission within a client (Mandant). For more information about the format of the scoped value seegetClientPermission(Mandant, String).- Parameters:
client- to scope permission toaccessProperty- to get a scoped permission value for- Returns:
- a scoped string value representing the permission within a client.
-
getClientPermission
Returns a string value representing the permission within aclient. Format of the string value:<client UUID>#<permission name>
- Parameters:
client- to scope permission topermissionName- to get a scoped permission value for- Returns:
- a scoped string value representing the permission within a client.
-
getSystemPermission
Returns a string value representing the permission forsystemscope. For more information about the format of the scoped value seegetSystemPermission(String).- Parameters:
accessProperty- to get a scoped permission value for- Returns:
- a scoped string value representing the permission for the
systemscope.
-
getSystemPermission
Returns a string value representing the permission forsystemscope. Format of the string value:SYSTEM#<permission name>
- Parameters:
permissionName- to get a scoped permission value for- Returns:
- a scoped string value representing the permission for the
systemscope.
-
getGeneralPermission
Returns a string value representing the permission for the general scope.- Parameters:
accessProperty- to get a permission value for.- Returns:
- a string value representing the permission for the general scope.
-
getGeneralPermission
Returns a string value representing the permission for the general scope.- Parameters:
permissionName- to get a permission value for.- Returns:
- a string value representing the permission for the general scope.
-
convert
- Parameters:
gender- to convert- Returns:
- converted gender
-
convert
Converts the given gender to a pac4jGenderand toGender.UNSPECIFIEDif no match was found ornull.- Parameters:
gender- to convert- Returns:
- converted gender
-
genPwd
Generates a password based on the configured system rules- Parameters:
pwdPolicyConfig- pwdPolicyConfig aListofSystemPropertys which specify the password policy rules- Returns:
- a generated Password
-
getPasswordStrength
Calculates the password-strength for password ui components. The ranges for levels in the ui component are:- 0,29: Weak
- 30,79: Medium
- 80,100: Strong
- Parameters:
newPassword- the password to calculate the strength ofrules- a list of system properties which specify the password policy rules- Returns:
Double
-
hashPassword
Paswort-Encryption. -
checkPassword
-
validatePassword
public static PasswordValidationResult validatePassword(String password, List<SystemProperty> systemConfig) Validates Passwords- Parameters:
password- the new passwordsystemConfig- list with system properties, which defines the use password policy rules if list is null or empty, the system defined default password policy rules will be used- Returns:
PasswordValidationResultwith validation-status and errors
-
validateDefaultPasswordRules
Validates the password with the default password rules.- Parameters:
password- the new password- Returns:
PasswordValidationResultwith validation-status and errors
-
validatePassword
public static PasswordValidationResult validatePassword(String oldPassword, String newPassword, List<SystemProperty> systemConfig) Validates Passwords- Parameters:
oldPassword- old passwords which should be permitted to use again. May benullor empty.newPassword- the new passwordsystemConfig- list with system properties, which defines the use password policy rules if list is null or empty, the system defined default password policy rules will be used- Returns:
PasswordValidationResultwith validation-status and errors
-
validatePassword
public static PasswordValidationResult validatePassword(String userName, String oldPassword, String newPassword, List<SystemProperty> systemConfig) Validates Passwords- Parameters:
userName- name of the user to permit passwords with username. May benullor empty.oldPassword- old passwords which should be permitted to use again. May benullor empty.newPassword- the new passwordsystemConfig- list with system properties, which defines the use password policy rules if list is null or empty, the system defined default password policy rules will be used- Returns:
PasswordValidationResultwith validation-status and errors
-
getMaskedUserAttribute
- Parameters:
value- user attribute value that is to be masked.- Returns:
- the masked user attribute.
-
getMaskedName
Masks the user name for privacy purposes. E.g.: "Joe Average" becomes "Jo**** Av****".- Parameters:
name- to be masked- Returns:
- the masked name
-
getMaskedEmailAddress
Masks the email address for privacy purposes. E.g.: "joe.average@example.com" becomes "j*****e@example.com".- Parameters:
email- to be masked- Returns:
- the masked email
- Throws:
IllegalArgumentException- if the given string is not an email.
-
getDefaultPasswordRules
This method returns a password policy with strict rules for the super user. This method should be used when the password policy on the database cannot be accessed.- Returns:
- list of password policy
Rules
-
getPasswordRules
public static List<org.passay.Rule> getPasswordRules(List<SystemProperty> pwdPolicyConfig, boolean useDefaultForGen) Determines the password policy rules set from the persisted system configuration. The persisted system configuration comes within the given systemConfig list.- Parameters:
pwdPolicyConfig- List ofSystemPropertysuseDefaultForGen- Flag for use functionality in password generation. If no rules configured (in system properties or pre default) the rules 'ALPABETICAL' and 'DIGITS' will be returned.- Returns:
- list of password policy
Rules
-
filterCharacterRules
-
filterFirstLengthRules
-
newAnonymousProfile
public static org.pac4j.core.profile.AnonymousProfile newAnonymousProfile() -
toJson
-
toJson
-
getRawData
public static com.alibaba.fastjson.JSONObject getRawData(org.pac4j.core.profile.UserProfile userProfile) -
getBenutzerFromUser
Deprecated. -
genPwd
Deprecated.usegenPwd(List)insteadPasswortgenerierung. -
encPwd
Deprecated. -
getTimeStamp
Deprecated.Token duration for password set/reset mails is handled in UserMailUtil.Liefert einen Zeitstempel (beginnend vom aktuellen Zeitpunkt) zurück, welcher, um die in den Parametern für Stunden und Minuten enthalten Werte, erweitert wurde.- Parameters:
addHours- Stunden, die zum aktuellen Zeitpunkt hinzugezählt werden sollenaddMinutes- Minuten, die zum aktuellen Zeitpunkt hinzugezählt werden sollen- Returns:
- ein Zeitstempel
-
dfltBgNameFor
Deprecated.Is handled inIClientCreateDataLiefert den lokalisierten Standard-Gruppennamen für Benutzer mit der übergebenen Rolle.- Returns:
- Den Gruppennamen.
-
isSetupUser
Deprecated.UseisSuperUser(IUser)instead.- Parameters:
user- User to check.- Returns:
trueif the given user is a setup user (sadmin), who can administrate the system.
-
isSetupUserWithoutClient
@Deprecated public static boolean isSetupUserWithoutClient(Benutzer user, javax.servlet.http.HttpSession session) Deprecated.- Parameters:
user- User to check.session- Optional session for retrieving the client.- Returns:
trueif the given user is a setup user and has not chosen a client.
-
isSetupUserWithClient
@Deprecated public static boolean isSetupUserWithClient(Benutzer user, javax.servlet.http.HttpSession session) Deprecated.- Parameters:
user- User to check.session- Optional session for retrieving the client.- Returns:
trueif the given user is a setup user and has chosen a client.
-
isSystemUser
Deprecated.Not needed anymore. Check againstVirtualUser.SYSTEMif it is really necessary. -
isAnonymousUser
Deprecated. -
isInternalUser
Deprecated.Not neede anymore.Method do determine if the given user is an internal and virtual user likeSETUP,ANONYMOUSorSYSTEM- Parameters:
user- the user to check- Returns:
trueif the user is internal,falseotherwise
-
isExternalUser
Deprecated. -
convertToProfile
Deprecated. -
getFromProfile
Deprecated. -
toJSON
@Deprecated public static com.alibaba.fastjson.JSONObject toJSON(Benutzer user, List<BenutzerGruppe> userGroups) Deprecated.UsetoJson(IUser, Mandant)instead. -
toJSON
@Deprecated public static com.alibaba.fastjson.JSONObject toJSON(Benutzer user, List<BenutzerGruppe> userGroups, org.pac4j.core.profile.CommonProfile prof) Deprecated.UsetoJson(IUser, Mandant)instead.
-
VirtualUser.ANONYMOUS