Closed
Description
This issue aims toward support for creating a MongoJsonSchema
containing encrypted fields for a given type based on mapping metadata. Currently encrypted fields can only be defined manually via the MongoJsonSchemaBuilder
.
MongoJsonSchema.builder()
.properties(
encrypted(string("ssn"))
.algorithm("AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic")
.keyId("...")
)
An @Encrypted
annotation should allow to derive required encryptMetadata
and encrypt
properties within a given (mapping)context.
@Document
@Encrypted(keyId = "...")
static class Patient {
// ...
@Encrypted(algorithm = "AEAD_AES_256_CBC_HMAC_SHA_512-Deterministic")
private Integer ssn;
}
MongoJsonSchemaCreator schemaCreator = MongoJsonSchemaCreator.create(mappingContext);
MongoJsonSchema patientSchema = schemaCreator
.filter(MongoJsonSchemaCreator.encryptedOnly())
.createSchemaFor(Patient.class);