Package de.xima.fc.utils
Class UserMgmtUtils
- java.lang.Object
-
- de.xima.fc.utils.UserMgmtUtils
-
- All Implemented Interfaces:
Serializable
public final class UserMgmtUtils extends Object implements Serializable
Hilfsklasse für Funktionalitäten der Benutzerverwaltung.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static BenutzerANONYMOUSVirtueller Benutzer für Fälle, bei denen ein Benutzer benötigt wird, aber keine Anmeldungen notwendig ist.static StringDEFAULT_PWD_SYMBOLSstatic BenutzerDESIGNER_INITIAL_DUMMYVirtueller Benutzer für Fälle, bei denen ein Benutzer benötigt wird, aber keine Anmeldungen notwendig ist.static BenutzerDESIGNER_LAST_DUMMYVirtueller Benutzer für Fälle, bei denen ein Benutzer benötigt wird, aber keine Anmeldungen notwendig ist.static BenutzerDESIGNER_USERVirtueller Benutzer für Fälle, bei denen ein Benutzer benötigt wird, aber keine Anmeldungen notwendig ist.static BenutzerSETUPVirtueller Benutzer für Fälle, bei denen ein Benutzer benötigt wird, aber keine Anmeldungen notwendig ist.static BenutzerSYSTEMVirtueller Benutzer für Fälle, bei denen ein Benutzer benötigt wird, aber keine Anmeldungen notwendig ist.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static booleancheckPassword(String clearTextPassword, String encryptedPassword)static org.pac4j.core.profile.CommonProfileconvertToProfile(Benutzer user)static StringdfltBgNameFor(ERollenTyp rolle, Locale locale)Liefert den lokalisierten Standard-Gruppennamen für Benutzer mit der übergebenen Rolle.static StringencPwd(String src)Deprecated.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 BenutzergetFromProfile(org.pac4j.core.profile.CommonProfile profile)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.static longgetTimeStamp(long addHours, long addMinutes)Liefert einen Zeitstempel (beginnend vom aktuellen Zeitpunkt) zurück, welcher, um die in den Parametern für Stunden und Minuten enthalten Werte, erweitert wurde.static StringhashPassword(String clearTextPassword)Paswort-Encryption.static booleanisAnonymousUser(Benutzer user)static booleanisExternalUser(Benutzer user)static booleanisInternalUser(Benutzer user)static booleanisSetupUser(Benutzer user)static booleanisSetupUserWithClient(Benutzer user, javax.servlet.http.HttpSession session)static booleanisSetupUserWithoutClient(Benutzer user, javax.servlet.http.HttpSession session)static booleanisSystemUser(Benutzer user)static com.alibaba.fastjson.JSONObjecttoJSON(Benutzer user, List<BenutzerGruppe> userGroups)static com.alibaba.fastjson.JSONObjecttoJSON(Benutzer user, List<BenutzerGruppe> userGroups, org.pac4j.core.profile.CommonProfile prof)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 Detail
-
ANONYMOUS
public static final Benutzer ANONYMOUS
Virtueller Benutzer für Fälle, bei denen ein Benutzer benötigt wird, aber keine Anmeldungen notwendig ist.
-
SYSTEM
public static final Benutzer SYSTEM
Virtueller Benutzer für Fälle, bei denen ein Benutzer benötigt wird, aber keine Anmeldungen notwendig ist.
-
SETUP
public static final Benutzer SETUP
Virtueller Benutzer für Fälle, bei denen ein Benutzer benötigt wird, aber keine Anmeldungen notwendig ist.
-
DESIGNER_USER
public static final Benutzer DESIGNER_USER
Virtueller Benutzer für Fälle, bei denen ein Benutzer benötigt wird, aber keine Anmeldungen notwendig ist.
-
DESIGNER_LAST_DUMMY
public static final Benutzer DESIGNER_LAST_DUMMY
Virtueller Benutzer für Fälle, bei denen ein Benutzer benötigt wird, aber keine Anmeldungen notwendig ist.
-
DESIGNER_INITIAL_DUMMY
public static final Benutzer DESIGNER_INITIAL_DUMMY
Virtueller Benutzer für Fälle, bei denen ein Benutzer benötigt wird, aber keine Anmeldungen notwendig ist.
-
DEFAULT_PWD_SYMBOLS
public static final String DEFAULT_PWD_SYMBOLS
- See Also:
- Constant Field Values
-
-
Method Detail
-
genPwd
@Deprecated public static String genPwd()
Deprecated.usegenPwd(List)insteadPasswortgenerierung.
-
genPwd
public static String genPwd(List<SystemProperty> pwdPolicyConfig)
Generates a password based on the configured system rules- Parameters:
pwdPolicyConfig- pwdPolicyConfig aListofSystemPropertys which specify the password policy rules- Returns:
- a generated Password
-
getPasswordStrength
public static int getPasswordStrength(String newPassword, List<org.passay.Rule> rules)
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
-
encPwd
@Deprecated public static String encPwd(String src)
Deprecated.
-
checkPassword
public static boolean checkPassword(String clearTextPassword, String encryptedPassword)
-
dfltBgNameFor
public static String dfltBgNameFor(ERollenTyp rolle, Locale locale)
Liefert den lokalisierten Standard-Gruppennamen für Benutzer mit der übergebenen Rolle.- Returns:
- Den Gruppennamen.
-
isSetupUser
public static boolean isSetupUser(Benutzer user)
- Parameters:
user- User to check.- Returns:
trueif the given user is a setup user (sadmin), who can administrate the system.
-
isSetupUserWithoutClient
public static boolean isSetupUserWithoutClient(Benutzer user, javax.servlet.http.HttpSession session)
- 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
public static boolean isSetupUserWithClient(Benutzer user, javax.servlet.http.HttpSession session)
- 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
public static boolean isSystemUser(Benutzer user)
-
isAnonymousUser
public static boolean isAnonymousUser(Benutzer user)
-
isInternalUser
public static boolean isInternalUser(Benutzer user)
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
public static boolean isExternalUser(Benutzer user)
-
getTimeStamp
public static long getTimeStamp(long addHours, long addMinutes)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
-
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
-
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
-
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
public static List<org.passay.CharacterRule> filterCharacterRules(List<org.passay.Rule> rules)
-
filterFirstLengthRules
public static org.passay.LengthRule filterFirstLengthRules(List<org.passay.Rule> rules)
-
convertToProfile
public static org.pac4j.core.profile.CommonProfile convertToProfile(Benutzer user)
-
getFromProfile
public static Benutzer getFromProfile(org.pac4j.core.profile.CommonProfile profile)
-
toJSON
public static com.alibaba.fastjson.JSONObject toJSON(Benutzer user, List<BenutzerGruppe> userGroups)
-
toJSON
public static com.alibaba.fastjson.JSONObject toJSON(Benutzer user, List<BenutzerGruppe> userGroups, org.pac4j.core.profile.CommonProfile prof)
-
-