java.lang.Object
de.powerstat.validation.values.Password
- All Implemented Interfaces:
IValueObject
,Comparable<Password>
Password.
DSGVO relevant.
TODO memory protection
TODO encryption algorithm (hashtypes)
TODO salt
TODO Disallow email address via verifyPassword
TODO Disallow user name (case) via verifyPassword
TODO Disallow user ID via verifyPassword
TODO password age in days
TODO Repeated/Reversed history length via verifyPassword
TODO validation chain
TODO Password generator
TODO Verify that password is not in:
https://www.datendieter.de/item/Haeufige_Passwoerter
https://www.passwortfuchs.de/passwortliste.php
https://crackstation.net/crackstation-wordlist-password-cracking-dictionary.htm
https://github.com/danielmiessler/SecLists/tree/master/Passwords
https://weakpass.com/wordlist
https://wiki.skullsecurity.org/Passwords
https://thehacktoday.com/password-cracking-dictionarys-download-for-free/
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Password
(IPasswordStrategy validationStrategy, String password, boolean noRead) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionint
Compare with another object.boolean
Is equal with another object.int
hashCode()
Calculate hash code.static Password
of
(IPasswordStrategy validationStrategy, String password) Password factory.static Password
of
(IPasswordStrategy validationStrategy, String password, boolean noRead) Password factory.static Password
Password factory with PasswordDefaultStrategy.static Password
Password factory with PasswordDefaultStrategy.Returns the value of this Password as a string or ******** if noRead was set during object creation.toString()
Returns the string representation of this Password.boolean
verifyPassword
(String password) Verify password.
-
Field Details
-
SECRET_PASSWORD
Hidden password.- See Also:
-
passwd
Password. -
read
private final boolean readPassword could be read via stringValue() if true.
-
-
Constructor Details
-
Password
Constructor.- Parameters:
validationStrategy
- Validation strategypassword
- PasswordnoRead
- true: password could not be read via stringValue(); false: password could be read- Throws:
NullPointerException
- if password or validationStrategy is nullIllegalArgumentException
- if password contains unsupported characters or is to long or short etc.
-
-
Method Details
-
of
Password factory.- Parameters:
validationStrategy
- Validation strategypassword
- PasswordnoRead
- true: password could not be read via stringValue(); false: password could be read- Returns:
- Password object
-
of
Password factory.- Parameters:
validationStrategy
- Validation strategypassword
- Password- Returns:
- Password object
-
of
Password factory with PasswordDefaultStrategy.- Parameters:
password
- PasswordnoRead
- true: password could not be read via stringValue(); false: password could be read- Returns:
- Password object
-
of
Password factory with PasswordDefaultStrategy.- Parameters:
password
- Password- Returns:
- Password object
-
stringValue
Returns the value of this Password as a string or ******** if noRead was set during object creation.- Specified by:
stringValue
in interfaceIValueObject
- Returns:
- The text value represented by this object after conversion to type string.
-
verifyPassword
Verify password.- Parameters:
password
- Password string to verify against this Password object- Returns:
- true when password has been successfully verified, false otherwise TODO encryption
-
hashCode
public int hashCode()Calculate hash code. -
equals
Is equal with another object. -
toString
Returns the string representation of this Password. The exact details of this representation are unspecified and subject to change, but the following may be regarded as typical: "Password[password=********]" -
compareTo
Compare with another object.- Specified by:
compareTo
in interfaceComparable<Password>
- Parameters:
obj
- Object to compare with- Returns:
- 0: equal; 1: greater; -1: smaller
- See Also:
-