Class TextEncryptorUtils.FailsafeTextEncryptor

java.lang.Object
org.springframework.cloud.bootstrap.encrypt.TextEncryptorUtils.FailsafeTextEncryptor
All Implemented Interfaces:
org.springframework.security.crypto.encrypt.TextEncryptor
Direct Known Subclasses:
EncryptionBootstrapConfiguration.FailsafeTextEncryptor, TextEncryptorConfigBootstrapper.FailsafeTextEncryptor
Enclosing class:
TextEncryptorUtils

public static class TextEncryptorUtils.FailsafeTextEncryptor extends Object implements org.springframework.security.crypto.encrypt.TextEncryptor
TextEncryptor that just fails, so that users don't get a false sense of security adding ciphers to config files and not getting them decrypted.
Author:
Dave Syer
  • Constructor Details

    • FailsafeTextEncryptor

      public FailsafeTextEncryptor()
  • Method Details

    • setDelegate

      public void setDelegate(org.springframework.security.crypto.encrypt.TextEncryptor delegate)
      You can set a delegate that can be used to encrypt/decrypt values if later on after the initial initialization of the app we have the necessary values to create a proper TextEncryptor. Depending on where the encryption keys are set we might not have the right values to create a TextEncryptor (this can happen if the keys are in application.properties for example, but we create the text encryptor during Bootstrap). The delegate functionality allows us the option to set the delegate later on when we have the necessary values.
      Parameters:
      delegate - The TextEncryptor to use for encryption/decryption
    • getDelegate

      public org.springframework.security.crypto.encrypt.TextEncryptor getDelegate()
    • encrypt

      public String encrypt(String text)
      Specified by:
      encrypt in interface org.springframework.security.crypto.encrypt.TextEncryptor
    • decrypt

      public String decrypt(String encryptedText)
      Specified by:
      decrypt in interface org.springframework.security.crypto.encrypt.TextEncryptor