use of io.apiman.common.util.crypt.DataEncryptionContext in project apiman by apiman.
the class PolicyBean method encryptData.
@PrePersist
@PreUpdate
protected void encryptData() {
// Encrypt the endpoint properties.
EntityType entityType = EntityType.Api;
if (type == PolicyType.Client) {
entityType = EntityType.ClientApp;
} else if (type == PolicyType.Plan) {
entityType = EntityType.Plan;
}
DataEncryptionContext ctx = new DataEncryptionContext(organizationId, entityId, entityVersion, entityType);
configuration = CurrentDataEncrypter.instance.encrypt(configuration, ctx);
}
use of io.apiman.common.util.crypt.DataEncryptionContext in project apiman by apiman.
the class PolicyBean method decryptData.
@PostPersist
@PostUpdate
@PostLoad
protected void decryptData() {
// Decrypt the endpoint properties.
EntityType entityType = EntityType.Api;
if (type == PolicyType.Client) {
entityType = EntityType.ClientApp;
} else if (type == PolicyType.Plan) {
entityType = EntityType.Plan;
}
DataEncryptionContext ctx = new DataEncryptionContext(organizationId, entityId, entityVersion, entityType);
configuration = CurrentDataEncrypter.instance.decrypt(configuration, ctx);
}
use of io.apiman.common.util.crypt.DataEncryptionContext in project apiman by apiman.
the class SecureRegistryWrapper method encryptPolicies.
/**
* @param entityType
* @param entityVersion
* @param entityId
* @param orgId
* @param entityType
* @param policies
*/
protected void encryptPolicies(String orgId, String entityId, String entityVersion, EntityType entityType, List<Policy> policies) {
if (policies != null) {
DataEncryptionContext ctx = new DataEncryptionContext(orgId, entityId, entityVersion, entityType);
for (Policy policy : policies) {
String jsonConfig = policy.getPolicyJsonConfig();
policy.setPolicyJsonConfig(encrypter.encrypt(jsonConfig, ctx));
}
}
}
use of io.apiman.common.util.crypt.DataEncryptionContext in project apiman by apiman.
the class ApiService method decryptEndpointProperties.
/**
* Decrypt the endpoint properties
*/
public void decryptEndpointProperties(ApiVersionBean versionBean) {
Map<String, String> endpointProperties = versionBean.getEndpointProperties();
if (endpointProperties != null) {
for (Entry<String, String> entry : endpointProperties.entrySet()) {
DataEncryptionContext ctx = new DataEncryptionContext(versionBean.getApi().getOrganization().getId(), versionBean.getApi().getId(), versionBean.getVersion(), EntityType.Api);
entry.setValue(encrypter.decrypt(entry.getValue(), ctx));
}
}
}
use of io.apiman.common.util.crypt.DataEncryptionContext in project apiman by apiman.
the class ApiService method encryptEndpointProperties.
/**
* Encrypt the endpoint properties
*/
private void encryptEndpointProperties(ApiVersionBean versionBean) {
Map<String, String> endpointProperties = versionBean.getEndpointProperties();
if (endpointProperties != null) {
for (Entry<String, String> entry : endpointProperties.entrySet()) {
DataEncryptionContext ctx = new DataEncryptionContext(versionBean.getApi().getOrganization().getId(), versionBean.getApi().getId(), versionBean.getVersion(), EntityType.Api);
entry.setValue(encrypter.encrypt(entry.getValue(), ctx));
}
}
}
Aggregations