Package com.jk.core.security
Class JKPasswordUtil
java.lang.Object
com.jk.core.security.JKPasswordUtil
This class is an utility class used for handling and generating passwords.
- Version:
- 1.0
- Author:
- Mohamed Kiswani
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
generateMixPassword
(int n) This method generates a password consisting of a mix of numeric, lower-case, and upper-case characters.static String
generateNumricPassword
(int numberOfChar) This method generates a numeric password consisting of digits.static String
getAlphapticPassowrds
(int numberOfChar, boolean islowerCase) This method generates an alphabetic password consisting of either lower-case or upper-case characters.static String
This method hashes the provided value using the default password hashing mechanism.static void
This main method prints a generated mixed password.static boolean
This method checks if a raw password matches an encoded password.
-
Constructor Details
-
JKPasswordUtil
public JKPasswordUtil()
-
-
Method Details
-
generateMixPassword
This method generates a password consisting of a mix of numeric, lower-case, and upper-case characters.- Parameters:
n
- Specifies the length of the generated password.- Returns:
- the generated password.
-
generateNumricPassword
This method generates a numeric password consisting of digits.- Parameters:
numberOfChar
- Specifies the number of digits in the generated password.- Returns:
- the generated numeric password.
-
getAlphapticPassowrds
This method generates an alphabetic password consisting of either lower-case or upper-case characters.- Parameters:
numberOfChar
- Specifies the number of characters in the generated password.islowerCase
- Specifies whether the password should be in lower-case (true), or upper-case (false).- Returns:
- the generated alphabetic password.
-
main
This main method prints a generated mixed password.- Parameters:
args
- the command line arguments.
-
hash
This method hashes the provided value using the default password hashing mechanism.- Parameters:
value
- Specifies the value to be hashed.- Returns:
- the hashed value.
-
matches
This method checks if a raw password matches an encoded password.- Parameters:
rawPassword
- Specifies the plain text password to be checked.encodedPassword
- Specifies the encoded password.- Returns:
- true, if the passwords match, false otherwise.
-