public class SecurityUtils extends Object
Constructor and Description |
---|
SecurityUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
buildPassword(IUserParameterService parameterService,
fr.paris.lutece.portal.service.plugin.Plugin plugin,
String strUserPassword)
Build the password depending of the encryption.
|
static String |
buildResetConnectionLogUrl(int nInterval,
javax.servlet.http.HttpServletRequest request)
Build an url to reset connection logs for an IP and a given user.
|
static String |
checkPasswordForBackOffice(IUserParameterService parameterService,
fr.paris.lutece.portal.service.plugin.Plugin plugin,
String strPassword,
javax.servlet.http.HttpServletRequest request)
Test a password validity
|
static String |
checkPasswordForFrontOffice(IUserParameterService parameterService,
fr.paris.lutece.portal.service.plugin.Plugin plugin,
String strPassword,
int nUserId)
Test a password validity
|
protected static boolean |
checkPasswordFormat(String strPassword,
IUserParameterService parameterService,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Check the format of the password from the entered parameters.
|
static Map<String,Object> |
checkSecurityParameters(IUserParameterService parameterService,
Map<String,Object> model,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Loads a model with base security parameters
|
protected static boolean |
checkUserPasswordMinimumLength(String strPassword,
IUserParameterService parameterService,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Check whether a password is long enough.
|
static Timestamp |
getAccountMaxValidDate(IUserParameterService parameterService,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Compute the maximum valid date of an account with the current time and
the parameters in the database.
|
static String[] |
getBannedDomainNames(IUserParameterService parameterService,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Get an array containing banned domain names for email adresses
|
static boolean |
getBooleanSecurityParameter(IUserParameterService parameterService,
fr.paris.lutece.portal.service.plugin.Plugin plugin,
String strParameterkey)
Get the boolean value of a security parameter
|
static int |
getIntegerSecurityParameter(IUserParameterService parameterService,
fr.paris.lutece.portal.service.plugin.Plugin plugin,
String strParameterkey)
Get the integer value of a security parameter
|
static String |
getLargeSecurityParameter(IUserParameterService parameterService,
fr.paris.lutece.portal.service.plugin.Plugin plugin,
String strParameterkey)
Get the large value of a security parameter.
|
static int |
getMaximumNumberPasswordChange(IUserParameterService parameterService,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Get the maximum number of time a user can change his password in a given
period
|
protected static String |
getMessageBackPasswordFormat(javax.servlet.http.HttpServletRequest request,
IUserParameterService parameterService,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Gets the admin message saying that the password does not match the
required format
|
static String |
getMessageFrontPasswordFormat(Locale locale,
IUserParameterService parameterService,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Gets the password message format
required format
|
protected static String |
getMessagePasswordMinimumLength(javax.servlet.http.HttpServletRequest request,
IUserParameterService parameterService,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Get the admin message telling the password length is too short.
|
static int |
getPasswordDuration(IUserParameterService parameterService,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Get the password duration
|
static int |
getPasswordHistorySize(IUserParameterService parameterService,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Get the password history size
|
static Timestamp |
getPasswordMaxValidDate(IUserParameterService parameterService,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Get the current maximum valid date of a password from the parameter
service.
|
static String |
getSecurityParameter(IUserParameterService parameterService,
fr.paris.lutece.portal.service.plugin.Plugin plugin,
String strParameterkey)
Get the value of a security parameter
|
static int |
getTSWSizePasswordChange(IUserParameterService parameterService,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Get the size of the time sliding window of passwor change
|
static boolean |
isAdvancedSecurityParametersUsed(IUserParameterService parameterService,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Get the parameter indicating that a password must contain numbers.
|
protected static boolean |
isPasswordFormatNumeroUsed(IUserParameterService parameterService,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Get the parameter indicating that a password must contain a numero
|
protected static boolean |
isPasswordFormatSpecialCharactersUsed(IUserParameterService parameterService,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Get the parameter indicating that a password must contain a numero
|
protected static boolean |
isPasswordFormatUpperLowerCaseUsed(IUserParameterService parameterService,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Get the parameter indicating that a password must contain upper and lower case.
|
static String |
makePassword(IUserParameterService parameterService,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Generate a new random password
|
static void |
removeAdvancedSecurityParameters(IUserParameterService parameterService,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Remove the advanced security parameters
|
static void |
updateLargeParameterValue(IUserParameterService parameterService,
fr.paris.lutece.portal.service.plugin.Plugin plugin,
String strKey,
String strValue)
Updates a parameter from its key with a new value.
|
static void |
updateParameterValue(IUserParameterService parameterService,
fr.paris.lutece.portal.service.plugin.Plugin plugin,
String strKey,
String strValue)
Updates a parameter from its key with a new value.
|
static void |
updateSecurityParameters(IUserParameterService parameterService,
javax.servlet.http.HttpServletRequest request,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Update security parameters from request parameters
|
static void |
useAdvancedSecurityParameters(IUserParameterService parameterService,
fr.paris.lutece.portal.service.plugin.Plugin plugin)
Enable advanced security parameters
|
public static Map<String,Object> checkSecurityParameters(IUserParameterService parameterService, Map<String,Object> model, fr.paris.lutece.portal.service.plugin.Plugin plugin)
parameterService
- The parameter service to usemodel
- The base model to loadplugin
- The pluginpublic static void updateSecurityParameters(IUserParameterService parameterService, javax.servlet.http.HttpServletRequest request, fr.paris.lutece.portal.service.plugin.Plugin plugin)
parameterService
- Parameter servicerequest
- Request to get the parameter fromplugin
- The pluginprotected static boolean checkUserPasswordMinimumLength(String strPassword, IUserParameterService parameterService, fr.paris.lutece.portal.service.plugin.Plugin plugin)
strPassword
- Password to checkparameterService
- Parameter service to get parameters from.plugin
- The pluginprotected static String getMessagePasswordMinimumLength(javax.servlet.http.HttpServletRequest request, IUserParameterService parameterService, fr.paris.lutece.portal.service.plugin.Plugin plugin)
request
- The requestparameterService
- Parameter service to get parameters from.plugin
- The pluginprotected static boolean isPasswordFormatUpperLowerCaseUsed(IUserParameterService parameterService, fr.paris.lutece.portal.service.plugin.Plugin plugin)
parameterService
- Parameter service to get parameters from.plugin
- The pluginprotected static boolean isPasswordFormatNumeroUsed(IUserParameterService parameterService, fr.paris.lutece.portal.service.plugin.Plugin plugin)
parameterService
- Parameter service to get parameters from.plugin
- The pluginprotected static boolean isPasswordFormatSpecialCharactersUsed(IUserParameterService parameterService, fr.paris.lutece.portal.service.plugin.Plugin plugin)
parameterService
- Parameter service to get parameters from.plugin
- The pluginpublic static int getPasswordDuration(IUserParameterService parameterService, fr.paris.lutece.portal.service.plugin.Plugin plugin)
parameterService
- Parameter service to get parameters from.plugin
- The pluginpublic static int getPasswordHistorySize(IUserParameterService parameterService, fr.paris.lutece.portal.service.plugin.Plugin plugin)
parameterService
- Parameter service to get parameters from.plugin
- The pluginpublic static int getTSWSizePasswordChange(IUserParameterService parameterService, fr.paris.lutece.portal.service.plugin.Plugin plugin)
parameterService
- Parameter service to get parameters from.plugin
- The pluginpublic static boolean isAdvancedSecurityParametersUsed(IUserParameterService parameterService, fr.paris.lutece.portal.service.plugin.Plugin plugin)
parameterService
- Parameter service to get parameters from.plugin
- The pluginpublic static int getMaximumNumberPasswordChange(IUserParameterService parameterService, fr.paris.lutece.portal.service.plugin.Plugin plugin)
parameterService
- Parameter service to get parameters from.plugin
- The pluginpublic static int getIntegerSecurityParameter(IUserParameterService parameterService, fr.paris.lutece.portal.service.plugin.Plugin plugin, String strParameterkey)
parameterService
- Parameter service to useplugin
- The pluginstrParameterkey
- Key of the security parameter to getpublic static boolean getBooleanSecurityParameter(IUserParameterService parameterService, fr.paris.lutece.portal.service.plugin.Plugin plugin, String strParameterkey)
parameterService
- Parameter service to useplugin
- The pluginstrParameterkey
- Key of the security parameter to getpublic static String getSecurityParameter(IUserParameterService parameterService, fr.paris.lutece.portal.service.plugin.Plugin plugin, String strParameterkey)
parameterService
- Parameter service to useplugin
- The pluginstrParameterkey
- Key of the security parameter to getpublic static String getLargeSecurityParameter(IUserParameterService parameterService, fr.paris.lutece.portal.service.plugin.Plugin plugin, String strParameterkey)
parameterService
- Parameter service to useplugin
- The pluginstrParameterkey
- Key of the security parameter to getprotected static String getMessageBackPasswordFormat(javax.servlet.http.HttpServletRequest request, IUserParameterService parameterService, fr.paris.lutece.portal.service.plugin.Plugin plugin)
request
- The requestparameterService
- Parameter service to useplugin
- The pluginpublic static String getMessageFrontPasswordFormat(Locale locale, IUserParameterService parameterService, fr.paris.lutece.portal.service.plugin.Plugin plugin)
locale
- the localeparameterService
- Parameter service to useplugin
- The pluginpublic static void updateParameterValue(IUserParameterService parameterService, fr.paris.lutece.portal.service.plugin.Plugin plugin, String strKey, String strValue)
parameterService
- Parameter service to useplugin
- The pluginstrKey
- The key of the parameter to updatestrValue
- The new value of the parameterpublic static void updateLargeParameterValue(IUserParameterService parameterService, fr.paris.lutece.portal.service.plugin.Plugin plugin, String strKey, String strValue)
parameterService
- Parameter service to useplugin
- The pluginstrKey
- The key of the parameter to updatestrValue
- The new value of the parameterpublic static void useAdvancedSecurityParameters(IUserParameterService parameterService, fr.paris.lutece.portal.service.plugin.Plugin plugin)
parameterService
- Parameter service to useplugin
- The pluginpublic static void removeAdvancedSecurityParameters(IUserParameterService parameterService, fr.paris.lutece.portal.service.plugin.Plugin plugin)
parameterService
- Parameter service to useplugin
- The pluginpublic static Timestamp getPasswordMaxValidDate(IUserParameterService parameterService, fr.paris.lutece.portal.service.plugin.Plugin plugin)
parameterService
- Parameter service to useplugin
- The pluginpublic static Timestamp getAccountMaxValidDate(IUserParameterService parameterService, fr.paris.lutece.portal.service.plugin.Plugin plugin)
parameterService
- Parameter service to useplugin
- The pluginpublic static String checkPasswordForFrontOffice(IUserParameterService parameterService, fr.paris.lutece.portal.service.plugin.Plugin plugin, String strPassword, int nUserId)
parameterService
- Paramter service to useplugin
- The pluginstrPassword
- The password to test validitynUserId
- The id of the userpublic static String checkPasswordForBackOffice(IUserParameterService parameterService, fr.paris.lutece.portal.service.plugin.Plugin plugin, String strPassword, javax.servlet.http.HttpServletRequest request)
parameterService
- Parameter service to useplugin
- The pluginstrPassword
- Password to checkrequest
- The requestpublic static String buildPassword(IUserParameterService parameterService, fr.paris.lutece.portal.service.plugin.Plugin plugin, String strUserPassword)
parameterService
- The parameter service to useplugin
- The pluginstrUserPassword
- the passwordpublic static String makePassword(IUserParameterService parameterService, fr.paris.lutece.portal.service.plugin.Plugin plugin)
parameterService
- The parameter service to usepublic static String[] getBannedDomainNames(IUserParameterService parameterService, fr.paris.lutece.portal.service.plugin.Plugin plugin)
parameterService
- Parameter serviceplugin
- The pluginpublic static String buildResetConnectionLogUrl(int nInterval, javax.servlet.http.HttpServletRequest request)
nInterval
- Interval of time to resetrequest
- The requestprotected static boolean checkPasswordFormat(String strPassword, IUserParameterService parameterService, fr.paris.lutece.portal.service.plugin.Plugin plugin)
strPassword
- The password to checkparameterService
- Parameter service to get parameters from.plugin
- The pluginCopyright © 2018 City of Paris. All rights reserved.