Class CasConfigurationJasyptCipherExecutor

java.lang.Object
org.apereo.cas.configuration.support.CasConfigurationJasyptCipherExecutor
All Implemented Interfaces:
org.apereo.cas.util.crypto.CipherExecutor<String,String>, org.apereo.cas.util.crypto.DecodableCipher<String,String>, org.apereo.cas.util.crypto.EncodableCipher<String,String>

public class CasConfigurationJasyptCipherExecutor extends Object implements org.apereo.cas.util.crypto.CipherExecutor<String,String>
Since:
5.1.0
  • Field Details

    • ENCRYPTED_VALUE_PREFIX

      public static final String ENCRYPTED_VALUE_PREFIX
      Prefix inserted at the beginning of a value to indicate it's encrypted.
      See Also:
  • Constructor Details

    • CasConfigurationJasyptCipherExecutor

      public CasConfigurationJasyptCipherExecutor(String algorithm, String password)
    • CasConfigurationJasyptCipherExecutor

      public CasConfigurationJasyptCipherExecutor(org.springframework.core.env.Environment environment)
  • Method Details

    • setAlgorithm

      public void setAlgorithm(String alg)
      Sets algorithm.
      Parameters:
      alg - the alg
    • setIvGenerator

      public void setIvGenerator(org.jasypt.iv.IvGenerator iv)
      Sets iv generator.
      Parameters:
      iv - the iv
    • setPassword

      public void setPassword(String psw)
      Sets password.
      Parameters:
      psw - the psw
    • setKeyObtentionIterations

      public void setKeyObtentionIterations(String iter)
      Sets key obtention iterations.
      Parameters:
      iter - the iter
    • setProviderName

      public void setProviderName(String pName)
      Sets provider name.
      Parameters:
      pName - the p name
    • encode

      public String encode(String value, Object[] parameters)
      Specified by:
      encode in interface org.apereo.cas.util.crypto.EncodableCipher<String,String>
    • decode

      public String decode(String value, Object[] parameters)
      Specified by:
      decode in interface org.apereo.cas.util.crypto.DecodableCipher<String,String>
    • getName

      public String getName()
      Specified by:
      getName in interface org.apereo.cas.util.crypto.CipherExecutor<String,String>
    • encryptValue

      public String encryptValue(String value, Function<Exception,String> handler)
      Encrypt value string.
      Parameters:
      value - the value
      handler - the handler
      Returns:
      the string
    • encryptValue

      public String encryptValue(String value)
      Encrypt value as string.
      Parameters:
      value - the value
      Returns:
      the string
    • decryptValue

      public String decryptValue(String value)
      Decrypt value string.
      Parameters:
      value - the value
      Returns:
      the string
    • isValueEncrypted

      public static boolean isValueEncrypted(String value)
      Is value encrypted, and does it start with the required prefix.
      Parameters:
      value - the value
      Returns:
      true/false
    • extractEncryptedValue

      public static String extractEncryptedValue(String value)
      Extract encrypted value as string to decode later.
      Parameters:
      value - the value
      Returns:
      the string