Module spring.data.mongodb
Class MongoEncryptionConverter
java.lang.Object
org.springframework.data.mongodb.core.convert.encryption.MongoEncryptionConverter
- All Implemented Interfaces:
PropertyValueConverter<Object,,Object, MongoConversionContext> EncryptingConverter<Object,,Object> MongoValueConverter<Object,Object>
Default implementation of
EncryptingConverter. Properties used with this converter must be annotated with
@Encrypted to provide key and algorithm metadata.- Since:
- 4.1
- Author:
- Christoph Strobl, Ross Lawley
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.data.convert.PropertyValueConverter
PropertyValueConverter.FunctionPropertyValueConverter<DV extends Object,SV extends Object, P extends PersistentProperty<P>>, PropertyValueConverter.ObjectToObjectPropertyValueConverter -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMongoEncryptionConverter(Encryption<org.bson.BsonValue, org.bson.BsonBinary> encryption, EncryptionKeyResolver keyResolver) -
Method Summary
Modifier and TypeMethodDescriptionObtain theEncryptionContextfor a givenvalue conversion context.decrypt(Object encryptedValue, EncryptionContext context) Decrypt the given encrypted source value within the givencontext.encrypt(Object value, EncryptionContext context) Encrypt the given raw source value within the givencontext.protected MongoPersistentPropertygetProperty(EncryptionContext context) read(Object value, MongoConversionContext context) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.data.mongodb.core.convert.encryption.EncryptingConverter
writeMethods inherited from interface org.springframework.data.convert.PropertyValueConverter
readNull, writeNull
-
Field Details
-
AND_OPERATOR
- See Also:
-
-
Constructor Details
-
MongoEncryptionConverter
public MongoEncryptionConverter(Encryption<org.bson.BsonValue, org.bson.BsonBinary> encryption, EncryptionKeyResolver keyResolver)
-
-
Method Details
-
read
- Specified by:
readin interfaceEncryptingConverter<Object,Object> - Specified by:
readin interfacePropertyValueConverter<Object,Object, MongoConversionContext>
-
decrypt
Description copied from interface:EncryptingConverterDecrypt the given encrypted source value within the givencontext.- Specified by:
decryptin interfaceEncryptingConverter<Object,Object> - Parameters:
encryptedValue- the encrypted source.context- the context to operate in.- Returns:
- never null.
-
encrypt
Description copied from interface:EncryptingConverterEncrypt the given raw source value within the givencontext.- Specified by:
encryptin interfaceEncryptingConverter<Object,Object> - Parameters:
value- the encrypted source.context- the context to operate in.- Returns:
- never null.
-
buildEncryptionContext
Description copied from interface:EncryptingConverterObtain theEncryptionContextfor a givenvalue conversion context.- Specified by:
buildEncryptionContextin interfaceEncryptingConverter<Object,Object> - Parameters:
context- the current MongoDB specificValueConversionContext.- Returns:
- the
EncryptionContextto operate in. - See Also:
-
getProperty
-