Skip to content
This repository has been archived by the owner on Mar 26, 2018. It is now read-only.

Commit

Permalink
feat(client side state): Addressing points rais...
Browse files Browse the repository at this point in the history
...ed in the code review
  • Loading branch information
zregvart committed Jul 26, 2017
1 parent f21f3c1 commit 3c9984d
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 26 deletions.
1 change: 0 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@
<junit.version>4.12</junit.version>
<keycloak.version>2.5.4.Final</keycloak.version>
<kubernetes.client.version>2.2.13</kubernetes.client.version>
<msgpack.version>0.8.13</msgpack.version>
<mockwebserver.version>0.0.12</mockwebserver.version>
<okhttp-eventsource.version>1.3.2</okhttp-eventsource.version>
<postgresql.version>9.1-901-1.jdbc4</postgresql.version>
Expand Down
5 changes: 0 additions & 5 deletions rest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,6 @@
<artifactId>guava</artifactId>
</dependency>

<dependency>
<groupId>org.msgpack</groupId>
<artifactId>jackson-dataformat-msgpack</artifactId>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
Expand Down
14 changes: 3 additions & 11 deletions rest/src/main/java/io/syndesis/rest/v1/state/ClientSideState.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
import com.fasterxml.jackson.databind.ObjectReader;
import com.fasterxml.jackson.databind.ObjectWriter;

import org.msgpack.jackson.dataformat.MessagePackFactory;

/**
* Persists given state on the client with these properties:
* <ul>
Expand Down Expand Up @@ -71,7 +69,7 @@ public final class ClientSideState {

private static final int IV_LEN = 16;

private static final ObjectMapper MAPPER = new ObjectMapper(new MessagePackFactory());
private static final ObjectMapper MAPPER = new ObjectMapper();

private final Edition edition;

Expand All @@ -86,18 +84,12 @@ public final class ClientSideState {
private final Supplier<Long> timeSource;

protected static final class RandomIvSource implements Supplier<byte[]> {
private static final ThreadLocal<SecureRandom> RANDOM = new ThreadLocal<SecureRandom>() {
@Override
protected SecureRandom initialValue() {
return new SecureRandom();
}
};
private static final SecureRandom RANDOM = new SecureRandom();

@Override
public byte[] get() {
final SecureRandom secureRandom = RANDOM.get();
final byte[] iv = new byte[IV_LEN];
secureRandom.nextBytes(iv);
RANDOM.nextBytes(iv);

return iv;
}
Expand Down
8 changes: 0 additions & 8 deletions runtime/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,3 @@ generator:
controllers:
integration:
enabled: true

client:
state:
authenticationAlgorithm: HmacSHA1
authenticationKey: oNXU5SBpNnU1UI/4ZkUAA2Gzikc=
encryptionAlgorithm: AES/CBC/PKCS5Padding
encryptionKey: IIAyKXfJTrIvjS6G9dHJLA==
tid: 1
6 changes: 5 additions & 1 deletion runtime/src/test/java/io/syndesis/runtime/BaseITCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@

import static org.assertj.core.api.Assertions.assertThat;

@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
properties = {"client.state.authenticationAlgorithm=HmacSHA1",
"client.state.authenticationKey=oNXU5SBpNnU1UI/4ZkUAA2Gzikc=",
"client.state.encryptionAlgorithm=AES/CBC/PKCS5Padding", "client.state.encryptionKey=IIAyKXfJTrIvjS6G9dHJLA==",
"client.state.tid=1"})
@ActiveProfiles("test")
public abstract class BaseITCase {

Expand Down

0 comments on commit 3c9984d

Please sign in to comment.