package org.apache.shiro.mgt; publicabstractclassAbstractRememberMeManagerimplementsRememberMeManager { /** * private inner log instance. */ privatestaticfinalLoggerlog= LoggerFactory.getLogger(AbstractRememberMeManager.class); /** * The following Base64 string was generated by auto-generating an AES Key: * <pre> * AesCipherService aes = new AesCipherService(); * byte[] key = aes.generateNewKey().getEncoded(); * String base64 = Base64.encodeToString(key); * </pre> * The value of 'base64' was copied-n-pasted here: */ privatestaticfinalbyte[] DEFAULT_CIPHER_KEY_BYTES = Base64.decode("kPH+bIxk5D2deZiIxcaaaA=="); /** * Serializer to use for converting PrincipalCollection instances to/from byte arrays */ private Serializer<PrincipalCollection> serializer; /** * Cipher to use for encrypting/decrypting serialized byte arrays for added security */ private CipherService cipherService; /** * Cipher encryption key to use with the Cipher when encrypting data */ privatebyte[] encryptionCipherKey; /** * Cipher decryption key to use with the Cipher when decrypting data */ privatebyte[] decryptionCipherKey; /** * Default constructor that initializes a {@link DefaultSerializer} as the {@link #getSerializer() serializer} and * an {@link AesCipherService} as the {@link #getCipherService() cipherService}. */ publicAbstractRememberMeManager() { this.serializer = newDefaultSerializer<PrincipalCollection>(); this.cipherService = newAesCipherService(); setCipherKey(DEFAULT_CIPHER_KEY_BYTES); }
package org.apache.shiro.mgt; publicabstractclassAbstractRememberMeManagerimplementsRememberMeManager { /** * Cipher encryption key to use with the Cipher when encrypting data */ privatebyte[] encryptionCipherKey; /** * Cipher decryption key to use with the Cipher when decrypting data */ privatebyte[] decryptionCipherKey; /** * Default constructor that initializes a {@link DefaultSerializer} as the {@link #getSerializer() serializer} and * an {@link AesCipherService} as the {@link #getCipherService() cipherService}. */ publicAbstractRememberMeManager() { this.serializer = newDefaultSerializer<PrincipalCollection>(); AesCipherServicecipherService=newAesCipherService(); this.cipherService = cipherService; setCipherKey(cipherService.generateNewKey().getEncoded()); } publicvoidsetCipherKey(byte[] cipherKey) { //Since this method should only be used in symmetric ciphers //(where the enc and dec keys are the same), set it on both: setEncryptionCipherKey(cipherKey); setDecryptionCipherKey(cipherKey); }
Spring Data Commons 1.13 - 1.13.10 (Ingalls SR10) Spring Data REST 2.6 - 2.6.10 (Ingalls SR10) Spring Data Commons 2.0 to 2.0.5 (Kay SR5) Spring Data REST 3.0 - 3.0.5 (Kay SR5)