Skip to content
Snippets Groups Projects
Commit 240d5ed3 authored by Andrew Case's avatar Andrew Case
Browse files

Updated client mod

parent 46314093
No related branches found
No related tags found
1 merge request!864Acceptance test new module
......@@ -17,6 +17,7 @@
package org.opengroup.osdu.util;
import com.google.common.base.Strings;
import lombok.ToString;
import lombok.extern.java.Log;
......@@ -24,14 +25,23 @@ import lombok.extern.java.Log;
@ToString
public class AnthosHTTPClient extends HTTPClient {
public static final String INTEGRATION_TESTER_TOKEN = "ROOT_USER_TOKEN";
private static String token = null;
private static OpenIDTokenProvider openIDTokenProvider = new OpenIDTokenProvider();
private static OpenIDTokenProvider openIDTokenProvider;
public AnthosHTTPClient() {
token = System.getProperty(INTEGRATION_TESTER_TOKEN, System.getenv(INTEGRATION_TESTER_TOKEN));
if (Strings.isNullOrEmpty(token)) {
openIDTokenProvider = new OpenIDTokenProvider();
}
}
@Override
public synchronized String getAccessToken() {
if (token == null) {
token = "Bearer " + openIDTokenProvider.getToken();
if (Strings.isNullOrEmpty(token)) {
token = openIDTokenProvider.getToken();
}
return token;
return "Bearer " + token;
}
}
\ No newline at end of file
}
......@@ -17,7 +17,6 @@
package org.opengroup.osdu.util;
import com.google.common.base.Strings;
import lombok.ToString;
import lombok.extern.java.Log;
......@@ -25,23 +24,14 @@ import lombok.extern.java.Log;
@ToString
public class AnthosHTTPClient extends HTTPClient {
public static final String INTEGRATION_TESTER_TOKEN = "ROOT_USER_TOKEN";
private static String token = null;
private static OpenIDTokenProvider openIDTokenProvider;
public AnthosHTTPClient() {
token = System.getProperty(INTEGRATION_TESTER_TOKEN, System.getenv(INTEGRATION_TESTER_TOKEN));
if (Strings.isNullOrEmpty(token)) {
openIDTokenProvider = new OpenIDTokenProvider();
}
}
private static OpenIDTokenProvider openIDTokenProvider = new OpenIDTokenProvider();
@Override
public synchronized String getAccessToken() {
if (Strings.isNullOrEmpty(token)) {
token = openIDTokenProvider.getToken();
if (token == null) {
token = "Bearer " + openIDTokenProvider.getToken();
}
return "Bearer " + token;
return token;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment