Skip to content

Commit

Permalink
Add codeowners
Browse files Browse the repository at this point in the history
  • Loading branch information
martinvisser authored and GuusdeWit committed Oct 2, 2023
1 parent feb67e3 commit cbde588
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
8 changes: 8 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This is a comment.
# Each line is a file pattern followed by one or more owners.

# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# @rabobank/skunkworks will be requested for
# review when someone opens a pull request.
* @rabobank/skunkworks
16 changes: 9 additions & 7 deletions src/main/java/io/github/rabobank/shadow_tool/ShadowFlow.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ public class ShadowFlow<T> {
private static final String INSTANCE_PREFIX_FORMAT = "[instance=%s]";
private static final String DEFAULT_INSTANCE_NAME = "default";
private static final String MESSAGE_FORMAT = "{} Calling new flow: {}";
private static final String DEFAULT_ALGORITHM = "RSA";
private static final String DEFAULT_ALGORITHM_MODE_PADDING =
DEFAULT_ALGORITHM + "/ECB/OAEPWITHSHA-256ANDMGF1PADDING";

private final int percentage;
private final ExecutorService executorService;
private final EncryptionService encryptionService;
Expand All @@ -45,7 +49,7 @@ public class ShadowFlow<T> {
final String instanceName) {
this.percentage = percentage;
this.encryptionService = encryptionService;
final String nonNullInstanceName = instanceName == null ? DEFAULT_INSTANCE_NAME : instanceName;
final var nonNullInstanceName = instanceName == null ? DEFAULT_INSTANCE_NAME : instanceName;
instanceNameLogPrefix = String.format(INSTANCE_PREFIX_FORMAT, nonNullInstanceName);

if (executorService != null) {
Expand Down Expand Up @@ -132,8 +136,7 @@ public Mono<T> compare(final Mono<T> currentFlow, final Mono<T> newFlow) {
newFlow.doOnNext(newResponse -> logDifferences(javers.compare(currentResponse, newResponse)))
.contextWrite(contextView)
.subscribeOn(scheduler)
.subscribe()
;
.subscribe();
}
}));
}
Expand Down Expand Up @@ -257,9 +260,7 @@ public ShadowFlowBuilder<T> withExecutorService(final ExecutorService executorSe
*/
public ShadowFlowBuilder<T> withEncryption(final PublicKey publicKey) {
try {
final String ALGORITHM = "RSA";
final String ALGORITHM_MODE_PADDING = ALGORITHM + "/ECB/OAEPWITHSHA-256ANDMGF1PADDING";
final var cipher = Cipher.getInstance(ALGORITHM_MODE_PADDING);
final var cipher = Cipher.getInstance(DEFAULT_ALGORITHM_MODE_PADDING);
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
withCipher(cipher);
} catch (Exception e) {
Expand Down Expand Up @@ -299,6 +300,7 @@ public ShadowFlowBuilder<T> withInstanceName(final String instanceName) {

/**
* Build a new ShadowFlow instance.
*
* @return New instance of ShadowFlow
*/
public ShadowFlow<T> build() {
Expand All @@ -308,7 +310,7 @@ public ShadowFlow<T> build() {
private int validatePercentage(final int percentage) {
if (percentage < ZERO || percentage > HUNDRED) {
logger.error("Invalid percentage! Must be within the range of 0 and 100. Got {}. " +
"The shadow flow will be effectively disabled by setting it to 0%.", percentage);
"The shadow flow will be effectively disabled by setting it to 0%.", percentage);
return ZERO;
}

Expand Down

0 comments on commit cbde588

Please sign in to comment.