Comments (4)
// overwrite the default mapper to support Java Optional and Encrypting of Sensitive fields
var objectMapper = new ObjectMapper();
objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
objectMapper.registerModule(new JavaTimeModule());
objectMapper.registerModule(new Jdk8Module());
objectMapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY);
// It seems like the key derivation at 256 takes a long time, so we reduce it here to 128.
var passwordCryptoContext = new PasswordCryptoContext(this.encryptionPassword, this.encryptionPassword, "AES/CBC/PKCS5Padding", "PBKDF2WithHmacSHA512", 5000, 128, "AES");
var encryptionService = new EncryptionService(objectMapper, passwordCryptoContext);
objectMapper.registerModule(new CryptoModule().addEncryptionService(encryptionService));
var jacksonJsonPayloadConverter = new JacksonJsonPayloadConverter(objectMapper);
// override the jackson converter
var defaultDataConverter = DefaultDataConverter.newDefaultInstance().withPayloadConverterOverrides(jacksonJsonPayloadConverter);
// instantiate the workflow service, which connects to the temporal cluster
var serviceOptions = WorkflowServiceStubsOptions.newBuilder()
.setTarget(target)
.setEnableHttps(useSSL)
.build();
workflowService = WorkflowServiceStubs.newInstance(serviceOptions);
// instatiate the workflow client, which specifies the temporal namespace
// and the data converter
var clientOptions = WorkflowClientOptions
.newBuilder()
.setNamespace(namespace)
.setDataConverter(defaultDataConverter)
.build();
workflowClient = WorkflowClient.newInstance(workflowService, clientOptions);
from samples-java.
@mapoulos will have to use jackson-json-crypto:1.1.0
cause our samples are built with java 1.8 (jackson-json-crypto after 2.x seems to require java 11) just fyi
from samples-java.
One thing I noticed: I had very bad performance with the default settings (256 key length). I think it was running the key generation for each decrypt and temporal was complaining about the thread not yielding within a second. Decreasing this down to 128 helped.
from samples-java.
@mapoulos thanks for the info!
from samples-java.
Related Issues (20)
- spring-boot-starter-web-2.7.12.jar: 6 vulnerabilities (highest severity is: 9.8) - autoclosed HOT 2
- spring-boot-starter-thymeleaf-2.7.12.jar: 1 vulnerabilities (highest severity is: 7.5) - autoclosed HOT 2
- serverlessworkflow-api-4.0.4.Final.jar: 1 vulnerabilities (highest severity is: 7.5) - autoclosed HOT 1
- [Bug] Replacing JaegerGrpcSpanExporter with OtlpGrpcSpanExporter is not working
- temporal-spring-boot-starter-alpha-1.22.2.jar: 13 vulnerabilities (highest severity is: 9.8) - autoclosed HOT 2
- logback-classic-1.4.11.jar: 1 vulnerabilities (highest severity is: 7.1) - autoclosed HOT 1
- logback-classic-1.4.12.jar: 1 vulnerabilities (highest severity is: 7.5) - autoclosed HOT 1
- json-path-2.8.0.jar: 1 vulnerabilities (highest severity is: 5.3) - autoclosed HOT 1
- temporal-spring-boot-starter-alpha-1.22.3.jar: 13 vulnerabilities (highest severity is: 9.8) - autoclosed HOT 2
- temporal-spring-boot-starter-alpha-1.22.3.jar: 14 vulnerabilities (highest severity is: 9.8)
- serverlessworkflow-validation-4.0.4.Final.jar: 2 vulnerabilities (highest severity is: 7.5) - autoclosed HOT 1
- [Feature Request] Add troubleshooting details to
- io.grpc.StatusRuntimeException: UNAVAILABLE: io exception
- [Feature Request] In metrics/prometheus sample, demonstrate millisecond histograms
- [Feature Request] Add sample showing graceful worker shutdown
- [Feature Request] Add sample showing how to locally timeout non heartbeating activity
- [Feature Request] Add Kotlin sample
- Allow users to switch between cloud and localhost when running samples
- [Feature Request] Default constructor on an input parameter 'Money transfer project' HOT 1
- [Feature Request] Move CI from Buildkite to GH actions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from samples-java.