Class GenericPasswordManagerModule
java.lang.Object
cz.metacentrum.perun.core.impl.modules.pwdmgr.GenericPasswordManagerModule
- All Implemented Interfaces:
PasswordManagerModule
- Direct Known Subclasses:
AdminmetaPasswordManagerModule
,EgiuiPasswordManagerModule
,EinfraPasswordManagerModule
,EinfraservicesPasswordManagerModule
,IcsmuniczPasswordManagerModule
,LifescienceidusernamePasswordManagerModule
,MuadmPasswordManagerModule
,SitolaPasswordManagerModule
,VsupPasswordManagerModule
Generic implementation of
PasswordManagerModule
. It runs generic password manger script defined as perun
config in CoreConfig.getPasswordManagerProgram()
or
CoreConfig.getAlternativePasswordManagerProgram()
.- Author:
- Pavel Zlamal invalid input: '<'zlamal@cesnet.cz>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String
protected String
protected static final String
protected static final Pattern
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected String
protected char[]
protected int
protected static final String
Fields inherited from interface cz.metacentrum.perun.core.implApi.modules.pwdmgr.PasswordManagerModule
ALT_PASSWORD_PREFIX, BIRTH_DAY_KEY, BIRTH_NUMBER_KEY, FIRST_NAME_KEY, LAST_NAME_KEY, LOGIN_PREFIX, MAIL_KEY, PASSWORD_KEY, TITLE_AFTER_KEY, TITLE_BEFORE_KEY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
changePassword
(PerunSession sess, String userLogin, String newPassword) void
checkLoginFormat
(PerunSession sess, String login) void
checkPassword
(PerunSession sess, String userLogin, String password) void
checkPasswordStrength
(PerunSession sess, String login, String password) void
createAlternativePassword
(PerunSession sess, User user, String passwordId, String password) protected Process
createAltPwdManagerProcess
(String operation, String loginNamespace, User user, String passwordId) protected Process
createPwdManagerProcess
(String operation, String loginNamespace, String login) Run password manager script on path defined in perun config.void
deleteAlternativePassword
(PerunSession sess, User user, String passwordId) void
deletePassword
(PerunSession sess, String userLogin) generateAccount
(PerunSession sess, Map<String, String> parameters) generateRandomPassword
(PerunSession sess, String login) protected void
handleAltPwdManagerExit
(Process process, User user, String loginNamespace, String passwordId) Wait for alternative password manager script to end and handle known return codes.protected void
handleExit
(Process process, String loginNamespace, String userLogin) Wait for password manager script to end and handle known return codes.protected void
handleGenericErrorCode
(InputStream errorStream) Handle error stream from password manager script on unexpected return code.boolean
loginExist
(PerunSession sess, String login) void
reservePassword
(PerunSession sess, String userLogin, String password) void
reserveRandomPassword
(PerunSession sess, String userLogin) protected void
sendPassword
(Process process, String password) Send password to the STDIN of running password manager script process.void
setActualLoginNamespace
(String actualLoginNamespace) void
validatePassword
(PerunSession sess, String userLogin, User user) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface cz.metacentrum.perun.core.implApi.modules.pwdmgr.PasswordManagerModule
handleSponsorship
-
Field Details
-
DEFAULT_LOGIN_PATTERN
-
PASSWORD_VALIDATE
- See Also:
-
PASSWORD_CREATE
- See Also:
-
PASSWORD_RESERVE
- See Also:
-
PASSWORD_RESERVE_RANDOM
- See Also:
-
PASSWORD_CHANGE
- See Also:
-
PASSWORD_CHECK
- See Also:
-
PASSWORD_DELETE
- See Also:
-
LOGIN_EXIST
- See Also:
-
WEAKPASS
- See Also:
-
BIN_TRUE
- See Also:
-
actualLoginNamespace
-
passwordManagerProgram
-
altPasswordManagerProgram
-
randomPasswordLength
protected int randomPasswordLength -
randomPasswordCharacters
protected char[] randomPasswordCharacters
-
-
Constructor Details
-
GenericPasswordManagerModule
public GenericPasswordManagerModule()
-
-
Method Details
-
changePassword
public void changePassword(PerunSession sess, String userLogin, String newPassword) throws InvalidLoginException, PasswordStrengthException - Specified by:
changePassword
in interfacePasswordManagerModule
- Throws:
InvalidLoginException
PasswordStrengthException
-
checkLoginFormat
- Specified by:
checkLoginFormat
in interfacePasswordManagerModule
- Throws:
InvalidLoginException
-
checkPassword
- Specified by:
checkPassword
in interfacePasswordManagerModule
-
checkPasswordStrength
public void checkPasswordStrength(PerunSession sess, String login, String password) throws PasswordStrengthException - Specified by:
checkPasswordStrength
in interfacePasswordManagerModule
- Throws:
PasswordStrengthException
-
createAltPwdManagerProcess
-
createAlternativePassword
public void createAlternativePassword(PerunSession sess, User user, String passwordId, String password) throws PasswordStrengthException - Specified by:
createAlternativePassword
in interfacePasswordManagerModule
- Throws:
PasswordStrengthException
-
createPwdManagerProcess
Run password manager script on path defined in perun config.- Parameters:
operation
- Operation to perform (reserve, reserveRandom, validate, check, change, delete)loginNamespace
- Namespace in which operation is performed.login
- Login to perform operation for- Returns:
- Started process
-
deleteAlternativePassword
- Specified by:
deleteAlternativePassword
in interfacePasswordManagerModule
-
deletePassword
- Specified by:
deletePassword
in interfacePasswordManagerModule
- Throws:
InvalidLoginException
-
generateAccount
- Specified by:
generateAccount
in interfacePasswordManagerModule
-
generateRandomPassword
- Specified by:
generateRandomPassword
in interfacePasswordManagerModule
-
getActualLoginNamespace
-
handleAltPwdManagerExit
protected void handleAltPwdManagerExit(Process process, User user, String loginNamespace, String passwordId) Wait for alternative password manager script to end and handle known return codes.- Parameters:
process
- Running password manager script process.user
- User for which operation was performed.loginNamespace
- Namespace in which operation was performed.passwordId
- ID of alt password entry for which it was performed.
-
handleExit
Wait for password manager script to end and handle known return codes.- Parameters:
process
- Running password manager script process.loginNamespace
- Namespace in which operation was performed.userLogin
- Login for which operation was performed.
-
handleGenericErrorCode
Handle error stream from password manager script on unexpected return code.- Parameters:
errorStream
- Password manager script error stream
-
loginExist
- Specified by:
loginExist
in interfacePasswordManagerModule
-
reservePassword
public void reservePassword(PerunSession sess, String userLogin, String password) throws InvalidLoginException, PasswordStrengthException - Specified by:
reservePassword
in interfacePasswordManagerModule
- Throws:
InvalidLoginException
PasswordStrengthException
-
reserveRandomPassword
- Specified by:
reserveRandomPassword
in interfacePasswordManagerModule
- Throws:
InvalidLoginException
-
sendPassword
Send password to the STDIN of running password manager script process.- Parameters:
process
- process waiting for password on STDINpassword
- password to be set
-
setActualLoginNamespace
-
validatePassword
public void validatePassword(PerunSession sess, String userLogin, User user) throws InvalidLoginException - Specified by:
validatePassword
in interfacePasswordManagerModule
- Throws:
InvalidLoginException
-