Skip to content

Commit 7189bf1

Browse files
committed
Changed key for encodedLocations and changed tests.
1 parent 6ae962f commit 7189bf1

File tree

7 files changed

+15
-10
lines changed

7 files changed

+15
-10
lines changed

oauth2_http/java/com/google/auth/oauth2/ComputeEngineCredentials.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,6 @@ public class ComputeEngineCredentials extends GoogleCredentials
131131

132132
private String universeDomainFromMetadata = null;
133133

134-
// private final boolean trustBoundaryEnabled;
135-
136134
/**
137135
* Experimental Feature.
138136
*
@@ -222,7 +220,6 @@ private ComputeEngineCredentials(ComputeEngineCredentials.Builder builder) {
222220
this.transport = builder.getGoogleAuthTransport();
223221
this.bindingEnforcement = builder.getBindingEnforcement();
224222
this.name = GoogleCredentialsInfo.COMPUTE_ENGINE_CREDENTIALS.getCredentialName();
225-
// this.trustBoundaryEnabled = builder.isTrustBoundaryEnabled();
226223
}
227224

228225
@Override

oauth2_http/java/com/google/auth/oauth2/DefaultCredentialsProvider.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ class DefaultCredentialsProvider {
115115
*/
116116
final GoogleCredentials getDefaultCredentials(HttpTransportFactory transportFactory)
117117
throws IOException {
118-
LOGGER.log(Level.FINE, "ajbhdabjh");
119118
synchronized (this) {
120119
if (cachedCredentials == null) {
121120
cachedCredentials = getDefaultCredentialsUnsynchronized(transportFactory);

oauth2_http/java/com/google/auth/oauth2/TrustBoundary.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,14 @@
3131

3232
package com.google.auth.oauth2;
3333

34-
import com.google.api.client.http.*;
34+
import com.google.api.client.http.GenericUrl;
35+
import com.google.api.client.http.HttpBackOffIOExceptionHandler;
36+
import com.google.api.client.http.HttpBackOffUnsuccessfulResponseHandler;
37+
import com.google.api.client.http.HttpIOExceptionHandler;
38+
import com.google.api.client.http.HttpRequest;
39+
import com.google.api.client.http.HttpRequestFactory;
40+
import com.google.api.client.http.HttpResponse;
41+
import com.google.api.client.http.HttpUnsuccessfulResponseHandler;
3542
import com.google.api.client.json.GenericJson;
3643
import com.google.api.client.json.JsonParser;
3744
import com.google.api.client.util.ExponentialBackOff;
@@ -81,7 +88,7 @@ public boolean isNoOp() {
8188

8289
/** Represents the JSON response from the trust boundary endpoint. */
8390
public static class TrustBoundaryResponse extends GenericJson {
84-
@Key("encoded_locations")
91+
@Key("encodedLocations")
8592
private String encodedLocations;
8693

8794
@Key("locations")
@@ -149,7 +156,7 @@ static TrustBoundary refresh(
149156
if (cachedTrustBoundary != null) {
150157
String headerValue =
151158
cachedTrustBoundary.isNoOp() ? "" : cachedTrustBoundary.getEncodedLocations();
152-
// request.getHeaders().set(TRUST_BOUNDARY_KEY, headerValue);
159+
request.getHeaders().set(TRUST_BOUNDARY_KEY, headerValue);
153160
}
154161

155162
// Add retry logic

oauth2_http/javatests/com/google/auth/oauth2/ComputeEngineCredentialsTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,9 @@ public void refresh_trustBoundaryFails_throwsIOException() throws IOException {
11771177
TrustBoundary.setEnvironmentProviderForTest(environmentProvider);
11781178
environmentProvider.setEnv("GOOGLE_AUTH_TRUST_BOUNDARY_ENABLE_EXPERIMENT", "1");
11791179

1180+
String defaultAccountEmail = "[email protected]";
11801181
MockMetadataServerTransportFactory transportFactory = new MockMetadataServerTransportFactory();
1182+
transportFactory.transport.setServiceAccountEmail(defaultAccountEmail);
11811183

11821184
ComputeEngineCredentials credentials =
11831185
ComputeEngineCredentials.newBuilder().setHttpTransportFactory(transportFactory).build();

oauth2_http/javatests/com/google/auth/oauth2/MockIAMCredentialsServiceTransport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ public LowLevelHttpResponse execute() throws IOException {
237237
}
238238
GenericJson responseJson = new GenericJson();
239239
responseJson.setFactory(OAuth2Utils.JSON_FACTORY);
240-
responseJson.put("encoded_locations", trustBoundary.getEncodedLocations());
240+
responseJson.put("encodedLocations", trustBoundary.getEncodedLocations());
241241
responseJson.put("locations", trustBoundary.getLocations());
242242
String content = responseJson.toPrettyString();
243243
return new MockLowLevelHttpResponse()

oauth2_http/javatests/com/google/auth/oauth2/MockMetadataServerTransport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ public LowLevelHttpResponse execute() throws IOException {
379379
}
380380
GenericJson responseJson = new GenericJson();
381381
responseJson.setFactory(OAuth2Utils.JSON_FACTORY);
382-
responseJson.put("encoded_locations", trustBoundary.getEncodedLocations());
382+
responseJson.put("encodedLocations", trustBoundary.getEncodedLocations());
383383
responseJson.put("locations", trustBoundary.getLocations());
384384
String content = responseJson.toPrettyString();
385385
return new MockLowLevelHttpResponse().setContentType(Json.MEDIA_TYPE).setContent(content);

oauth2_http/javatests/com/google/auth/oauth2/MockTokenServerTransport.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ public LowLevelHttpResponse execute() throws IOException {
336336
}
337337
GenericJson responseJson = new GenericJson();
338338
responseJson.setFactory(JSON_FACTORY);
339-
responseJson.put("encoded_locations", trustBoundary.getEncodedLocations());
339+
responseJson.put("encodedLocations", trustBoundary.getEncodedLocations());
340340
responseJson.put("locations", trustBoundary.getLocations());
341341
String content = responseJson.toPrettyString();
342342
return new MockLowLevelHttpResponse()

0 commit comments

Comments
 (0)