Skip to content

Commit a2ca438

Browse files
committed
Stop client credentials token from being retrieved twice; Give SSL checking flag to codekit
1 parent 2ad1a44 commit a2ca438

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed
1 Byte
Binary file not shown.

sdk/server/java/src/com/html5sdk/att/provider/ClientCredentialsManager.java

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@ public ClientCredentialsManager(String host, String apiKey,
8282
if (timedFetch) {
8383
this.timer = new Timer();
8484
this.timer.schedule(new FetchToken(), 0);
85+
} else {
86+
try {
87+
fetchOAuthToken();
88+
} catch (ApiRequestException fex) {
89+
log.info("CCM fetch failed: " + fex.toString());
90+
} catch (Exception fex) {
91+
log.info("CCM fetch failed: " + fex.toString());
92+
}
8593
}
8694
}
8795

@@ -98,13 +106,15 @@ public OAuthToken fetchOAuthToken() throws ApiRequestException {
98106
return this.currentOAuthToken;
99107
}
100108
try {
101-
// TODO: This URL should come from properties
102-
//OAuthService svc = new OAuthService("https://api-uat.mars.bf.sl.attcompute.com",
103-
OAuthService svc = new OAuthService("https://api.att.com",
109+
log.info("ClientCredentialsManager.fetchOAuthToken: Fetching new token from " + this.host + " for client " + this.apiKey);
110+
OAuthService svc = new OAuthService(this.host,
104111
this.apiKey, this.apiSecret);
105112
this.currentOAuthToken = svc.getToken(this.scope);
113+
log.info("ClientCredentialsManager.fetchOAuthToken successful: " +
114+
currentOAuthToken.getAccessToken());
106115
return this.currentOAuthToken;
107116
} catch (RESTException ex) {
117+
log.info("ClientCredentialsManager.fetchOAuthToken failed. " + ex.toString());
108118
throw new ApiRequestException("could not get oauth token", 403,
109119
"{\"error\":\"could not get oauth token\"}", ex);
110120
}
@@ -215,7 +225,7 @@ class FetchToken extends TimerTask {
215225
public void run() {
216226
try {
217227
fetchOAuthToken();
218-
fetchToken(false);
228+
//fetchToken(false);
219229

220230
} catch (Exception e) {
221231
log.severe("Could not fetch auth token" + e.getMessage());
@@ -236,5 +246,6 @@ public void run() {
236246
public String getCurrentToken() {
237247
return currentAuthToken;
238248
}
249+
239250

240-
}
251+
}

sdk/server/java/src/com/html5sdk/att/servlet/ServiceServletBase.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ abstract class ServiceServletBase extends HttpServlet {
3939
public ServiceServletBase() {
4040
super();
4141
RESTConfig.setDefaultClientSdk(AttConstants.XARG_CLIENT_SDK);
42+
RESTConfig.setDefaultTrustAllCerts( ! AttConstants.ENABLE_SSL_CHECK);
4243
}
4344

4445
/**

0 commit comments

Comments
 (0)