Package com.atlassian.crowd.crypto
Class ClusterLockingEncryptor
java.lang.Object
com.atlassian.crowd.crypto.ClusterLockingEncryptor
- All Implemented Interfaces:
Encryptor,SwitchableEncryptor
Encryptor that synchronizes on given cluster lock when doing encryption.-
Constructor Summary
ConstructorsConstructorDescriptionClusterLockingEncryptor(SwitchableEncryptor delegate, com.atlassian.beehive.ClusterLockService clusterLockService) -
Method Summary
Modifier and TypeMethodDescriptionbooleanGenerate 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.voidswitchEncryptor(String encryptorKey) Switches theEncryptorto the one specified byencryptorKeyor disable encryption whenencryptorKeyis null.
-
Constructor Details
-
ClusterLockingEncryptor
public ClusterLockingEncryptor(SwitchableEncryptor delegate, com.atlassian.beehive.ClusterLockService clusterLockService)
-
-
Method Details
-
encrypt
Description copied from interface:EncryptorEncrypt plaintext password, and return encrypted value which can later be used in decrypt method to get plaintext password. -
decrypt
Description copied from interface:EncryptorDecrypt 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:EncryptorGenerate new encryption key, which should be used to encrypt password in following calls toEncryptor.encrypt(java.lang.String).- Specified by:
changeEncryptionKeyin interfaceEncryptor- Returns:
- true if generation was successful, or false when encryption key migration is not supported
-
switchEncryptor
Description copied from interface:SwitchableEncryptorSwitches theEncryptorto the one specified byencryptorKeyor disable encryption whenencryptorKeyis null.- Specified by:
switchEncryptorin interfaceSwitchableEncryptor- Parameters:
encryptorKey- identifies one of theEncryptoror no encryption when null.
-
getAvailableEncryptorKeys
- Specified by:
getAvailableEncryptorKeysin interfaceSwitchableEncryptor- Returns:
- available encryptors' keys
-
getCurrentEncryptorKey
- Specified by:
getCurrentEncryptorKeyin interfaceSwitchableEncryptor- Returns:
- key of the currently used
EncryptororOptional.empty()when encryption is disabled
-