Skip to content

Instantly share code, notes, and snippets.

@IVedmak
IVedmak / gist:c40883df7802a949c33f
Created June 25, 2014 07:45
Complex version of AttributeEncryptionListener (support nested objects with attributes + decrypting in memory objects back)
@Component
public class AttributeEncryptionListener extends AbstractMongoEventListener {
/**
* This method called first before object persistence. It encrypts all the attributes of password type
*/
@Override
public void onBeforeConvert(Object source) {
super.onBeforeConvert(source);
passwordsPersistenceCare(source, true);
@IVedmak
IVedmak / Attribute
Last active August 29, 2015 14:01
Solution for saving encrypted password attribute in mongodb
public class Attribute<T> extends BaseModel {
private String parentObjectName;
private AttributeType attributeType;
private String name;
private String displayName;
private String fullName;
private T value;
private T defaultValue;
// add getters and setters