Package com.atlassian.crowd.crypto
Class CachedEncryptor
java.lang.Object
com.atlassian.crowd.crypto.CachedEncryptor
- All Implemented Interfaces:
Encryptor
Wrapper that caches encryption and decryption results.
-
Constructor Summary
ConstructorDescriptionCachedEncryptor
(Encryptor delegate, long maxCacheSize, Duration expireAfterAccess, BooleanSupplier cacheEnabledSupplier) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Generate new encryption key, which should be used to encrypt password in following calls toEncryptor.encrypt(java.lang.String)
.Decrypt encrypted password, and return its original value.Encrypt plaintext password, and return encrypted value which can later be used in decrypt method to get plaintext password.
-
Constructor Details
-
CachedEncryptor
public CachedEncryptor(Encryptor delegate, long maxCacheSize, Duration expireAfterAccess, BooleanSupplier cacheEnabledSupplier)
-
-
Method Details
-
encrypt
Description copied from interface:Encryptor
Encrypt plaintext password, and return encrypted value which can later be used in decrypt method to get plaintext password. -
decrypt
Description copied from interface:Encryptor
Decrypt encrypted password, and return its original value.In case of any error during decryption (such as missing decryption key) return
encryptedPassword
. -
changeEncryptionKey
public boolean changeEncryptionKey()Description copied from interface:Encryptor
Generate new encryption key, which should be used to encrypt password in following calls toEncryptor.encrypt(java.lang.String)
.- Specified by:
changeEncryptionKey
in interfaceEncryptor
- Returns:
- true if generation was successful, or false when encryption key migration is not supported
-