com.ulisesbocchio.jasyptspringboot.EncryptableEnumerablePropertySourceWrapper Maven / Gradle / Ivy
package com.ulisesbocchio.jasyptspringboot;
import org.jasypt.encryption.StringEncryptor;
import org.springframework.core.env.EnumerablePropertySource;
import org.springframework.util.Assert;
/**
* @author Ulises Bocchio
*/
public class EncryptableEnumerablePropertySourceWrapper extends EnumerablePropertySource implements EncryptablePropertySource {
private final EnumerablePropertySource delegate;
private final StringEncryptor encryptor;
public EncryptableEnumerablePropertySourceWrapper(EnumerablePropertySource delegate, StringEncryptor encryptor) {
super(delegate.getName(), delegate.getSource());
Assert.notNull(delegate, "PropertySource delegate cannot be null");
Assert.notNull(encryptor, "StringEncryptor cannot be null");
this.delegate = delegate;
this.encryptor = encryptor;
}
@Override
public Object getProperty(String name) {
return getProperty(encryptor, delegate, name);
}
@Override
public String[] getPropertyNames() {
return delegate.getPropertyNames();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy