public class ClusterLockingEncryptor extends Object implements SwitchableEncryptor
Encryptor that synchronizes on given cluster lock when doing encryption.| Constructor and Description |
|---|
ClusterLockingEncryptor(SwitchableEncryptor delegate,
com.atlassian.beehive.ClusterLockService clusterLockService) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
changeEncryptionKey()
Generate new encryption key, which should be used to encrypt password in following calls to
Encryptor.encrypt(java.lang.String). |
String |
decrypt(String encryptedPassword)
Decrypt encrypted password, and return its original value.
|
String |
encrypt(String password)
Encrypt plaintext password, and return encrypted value which can later be used in decrypt method to get plaintext password.
|
Collection<String> |
getAvailableEncryptorKeys() |
Optional<String> |
getCurrentEncryptorKey() |
void |
switchEncryptor(String encryptorKey)
Switches the
Encryptor to the one specified by encryptorKey or disable encryption when
encryptorKey is null. |
public ClusterLockingEncryptor(SwitchableEncryptor delegate, com.atlassian.beehive.ClusterLockService clusterLockService)
public String encrypt(String password)
Encryptorpublic String decrypt(String encryptedPassword)
Encryptor
In case of any error during decryption (such as missing decryption key) return encryptedPassword.
public boolean changeEncryptionKey()
EncryptorEncryptor.encrypt(java.lang.String).changeEncryptionKey in interface Encryptorpublic void switchEncryptor(@Nullable String encryptorKey)
SwitchableEncryptorEncryptor to the one specified by encryptorKey or disable encryption when
encryptorKey is null.switchEncryptor in interface SwitchableEncryptorencryptorKey - identifies one of the Encryptor or no encryption when null.public Collection<String> getAvailableEncryptorKeys()
getAvailableEncryptorKeys in interface SwitchableEncryptorpublic Optional<String> getCurrentEncryptorKey()
getCurrentEncryptorKey in interface SwitchableEncryptorEncryptor or Optional.empty() when encryption is disabledCopyright © 2023 Atlassian. All rights reserved.