Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for deriving json schema for encrypted properties. #3800

Closed
christophstrobl opened this issue Sep 6, 2021 · 2 comments
Closed
Assignees
Labels
type: enhancement A general enhancement

Comments

@christophstrobl
Copy link
Member

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);
@christophstrobl christophstrobl added the type: enhancement A general enhancement label Sep 6, 2021
@christophstrobl christophstrobl self-assigned this Sep 6, 2021
@jagadeeshkoka
Copy link

Can I work on this one ?

@christophstrobl
Copy link
Member Author

christophstrobl commented Sep 6, 2021

@jagadeeshkoka there's a PR (#3801). Please feel free to add your thoughts.

@mp911de mp911de added this to the 3.3 M3 (2021.1.0) milestone Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants