Class CustomPasswordEncoder
java.lang.Object
org.opencastproject.kernel.security.CustomPasswordEncoder
- All Implemented Interfaces:
org.springframework.security.crypto.password.PasswordEncoder
public class CustomPasswordEncoder
extends Object
implements org.springframework.security.crypto.password.PasswordEncoder
Password encoder using bcrypt for password hashing
Breaking change: no more backwards support for very old md5 based passwords.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionencode(CharSequence rawPassword) Encode the raw password for storage using bcrypt.booleanmatches(CharSequence rawPassword, String encodedPassword) Verify the encoded password obtained from storage matches the submitted raw password after it too is encoded.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.security.crypto.password.PasswordEncoder
upgradeEncoding
-
Constructor Details
-
CustomPasswordEncoder
public CustomPasswordEncoder()
-
-
Method Details
-
encode
Encode the raw password for storage using bcrypt.- Specified by:
encodein interfaceorg.springframework.security.crypto.password.PasswordEncoder- Parameters:
rawPassword- raw password to encrypt/hash- Returns:
- hashed password
-
matches
Verify the encoded password obtained from storage matches the submitted raw password after it too is encoded. Returns true if the passwords match, false if they do not. The stored password itself is never decoded.- Specified by:
matchesin interfaceorg.springframework.security.crypto.password.PasswordEncoder- Parameters:
rawPassword- the raw password to encode and matchencodedPassword- the encoded password from storage to compare with- Returns:
- true if the raw password, after encoding, matches the encoded password from storage
-