Skip to content
This repository has been archived by the owner on Dec 18, 2020. It is now read-only.

Commit

Permalink
Remove Cerberus specific stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
sdford committed May 1, 2017
1 parent 870265e commit d0413cc
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 27 deletions.
6 changes: 3 additions & 3 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ repositories {

dependencies {
compile "org.apache.commons:commons-lang3:3.4"
compile "com.squareup.okhttp3:okhttp:3.3.1"
compile "com.squareup.okhttp3:okhttp:3.7.0"
compile "com.google.code.gson:gson:2.5"
compile "com.google.code.findbugs:jsr305:3.0.1"
compile "org.slf4j:slf4j-api:1.7.14"
compile "org.slf4j:slf4j-api:1.7.25"

testCompile "junit:junit:4.12"
testCompile "org.mockito:mockito-core:1.10.19"
testCompile "org.powermock:powermock-api-mockito:1.6.4"
testCompile "org.powermock:powermock-module-junit4:1.6.4"
testCompile "org.assertj:assertj-core:2.3.0"
testCompile "com.squareup.okhttp3:mockwebserver:3.0.1"
testCompile "com.squareup.okhttp3:mockwebserver:3.7.0"
testCompile "commons-io:commons-io:2.4"
}
9 changes: 0 additions & 9 deletions src/main/java/com/nike/vault/client/ClientVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ public class ClientVersion {

private static final String VAULT_CLIENT_VERSION_PROPERTY = "java_vault_client.version";

public static final String CERBERUS_CLIENT_HEADER = "X-Cerberus-Client";

protected static final String HEADER_VALUE_PREFIX = "JavaVaultClient/";


public static String getVersion() {

String clientVersion = "unknown";
Expand All @@ -53,8 +48,4 @@ public static String getVersion() {

return clientVersion;
}

public static String getClientHeaderValue() {
return HEADER_VALUE_PREFIX + getVersion();
}
}
7 changes: 1 addition & 6 deletions src/main/java/com/nike/vault/client/VaultClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ public class VaultClient {

private final Logger logger = LoggerFactory.getLogger(getClass());

private final String javaVaultClientHeaderValue;


/**
* Explicit constructor that allows for full control over construction of the Vault client.
*
Expand All @@ -97,7 +94,6 @@ public VaultClient(final UrlResolver vaultUrlResolver,
this.urlResolver = vaultUrlResolver;
this.credentialsProvider = credentialsProvider;
this.httpClient = httpClient;
this.javaVaultClientHeaderValue = ClientVersion.getClientHeaderValue();
}


Expand Down Expand Up @@ -270,8 +266,7 @@ protected Response execute(final HttpUrl url, final String method, final Object
Request.Builder requestBuilder = new Request.Builder()
.url(url)
.addHeader(HttpHeader.VAULT_TOKEN, credentialsProvider.getCredentials().getToken())
.addHeader(HttpHeader.ACCEPT, DEFAULT_MEDIA_TYPE.toString())
.addHeader(ClientVersion.CERBERUS_CLIENT_HEADER, javaVaultClientHeaderValue);
.addHeader(HttpHeader.ACCEPT, DEFAULT_MEDIA_TYPE.toString());

if (requestBody != null) {
requestBuilder.addHeader(HttpHeader.CONTENT_TYPE, DEFAULT_MEDIA_TYPE.toString())
Expand Down
9 changes: 0 additions & 9 deletions src/test/java/com/nike/vault/client/ClientVersionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@

package com.nike.vault.client;

import org.apache.commons.lang3.StringUtils;
import org.junit.Test;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

/**
* Tests ClientVersion class
Expand All @@ -36,11 +34,4 @@ public void test_that_version_file_exists() {
public void test_that_version_is_not_null() {
assertNotNull(ClientVersion.getVersion());
}

@Test
public void test_that_header_value_includes_right_prefix() {

String result = ClientVersion.getClientHeaderValue();
assertTrue(StringUtils.contains(result, ClientVersion.HEADER_VALUE_PREFIX));
}
}

0 comments on commit d0413cc

Please sign in to comment.