Skip to content

Commit 6ae962f

Browse files
committed
Trust Boundary Recovery
1 parent 933cdd3 commit 6ae962f

File tree

5 files changed

+15
-16
lines changed

5 files changed

+15
-16
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ public class ComputeEngineCredentials extends GoogleCredentials
131131

132132
private String universeDomainFromMetadata = null;
133133

134-
private final boolean trustBoundaryEnabled;
134+
// private final boolean trustBoundaryEnabled;
135135

136-
/**
136+
/**
137137
* Experimental Feature.
138138
*
139139
* <p>{@link GoogleAuthTransport} specifies how to authenticate to Google APIs.
@@ -222,7 +222,7 @@ private ComputeEngineCredentials(ComputeEngineCredentials.Builder builder) {
222222
this.transport = builder.getGoogleAuthTransport();
223223
this.bindingEnforcement = builder.getBindingEnforcement();
224224
this.name = GoogleCredentialsInfo.COMPUTE_ENGINE_CREDENTIALS.getCredentialName();
225-
this.trustBoundaryEnabled = builder.isTrustBoundaryEnabled();
225+
// this.trustBoundaryEnabled = builder.isTrustBoundaryEnabled();
226226
}
227227

228228
@Override
@@ -717,7 +717,7 @@ public HttpTransportFactory getTransportFactory() {
717717
@Override
718718
public String getTrustBoundaryUrl() throws IOException {
719719
if (principal == null) {
720-
principal = getDefaultServiceAccount();
720+
principal = getDefaultServiceAccount();
721721
}
722722
return String.format(
723723
"https://iamcredentials.%s/v1/projects/-/serviceAccounts/%s/allowedLocations",

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
import java.util.List;
5656
import java.util.Map;
5757
import java.util.Objects;
58-
5958
import javax.annotation.Nullable;
6059

6160
/** Base type for credentials for authorizing calls to Google APIs using OAuth2. */
@@ -423,7 +422,7 @@ protected void refreshTrustBoundaries(AccessToken newAccessToken) throws IOExcep
423422
}
424423
}
425424

426-
@Override
425+
@Override
427426
protected Map<String, List<String>> getAdditionalHeaders() {
428427
Map<String, List<String>> headers = new HashMap<>(super.getAdditionalHeaders());
429428
String quotaProjectId = this.getQuotaProjectId();

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ public class ServiceAccountCredentials extends GoogleCredentials
152152
this.defaultRetriesEnabled = builder.defaultRetriesEnabled;
153153
this.name = GoogleCredentialsInfo.SERVICE_ACCOUNT_CREDENTIALS.getCredentialName();
154154
this.principal = builder.clientEmail;
155-
this.trustBoundaryEnabled = builder.trustBoundaryEnabled;
156155
}
157156

158157
/**

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@
8080
import java.util.List;
8181
import java.util.Map;
8282
import java.util.concurrent.atomic.AtomicBoolean;
83+
import org.junit.After;
8384
import org.junit.Test;
8485
import org.junit.runner.RunWith;
8586
import org.junit.runners.JUnit4;
86-
import org.junit.After;
8787

8888
/** Test case for {@link ServiceAccountCredentials}. */
8989
@RunWith(JUnit4.class)
@@ -1822,14 +1822,15 @@ public void refresh_trustBoundarySuccess() throws IOException {
18221822
transport.addServiceAccount("[email protected]", "test-access-token");
18231823
transport.setTrustBoundary(trustBoundary);
18241824

1825-
ServiceAccountCredentials credentials = ServiceAccountCredentials.newBuilder()
1826-
.setClientEmail("[email protected]")
1827-
.setPrivateKey(
1828-
OAuth2Utils.privateKeyFromPkcs8(ServiceAccountCredentialsTest.PRIVATE_KEY_PKCS8))
1829-
.setPrivateKeyId("test-key-id")
1830-
.setHttpTransportFactory(() -> transport)
1831-
.setScopes(SCOPES)
1832-
.build();
1825+
ServiceAccountCredentials credentials =
1826+
ServiceAccountCredentials.newBuilder()
1827+
.setClientEmail("[email protected]")
1828+
.setPrivateKey(
1829+
OAuth2Utils.privateKeyFromPkcs8(ServiceAccountCredentialsTest.PRIVATE_KEY_PKCS8))
1830+
.setPrivateKeyId("test-key-id")
1831+
.setHttpTransportFactory(() -> transport)
1832+
.setScopes(SCOPES)
1833+
.build();
18331834

18341835
Map<String, List<String>> headers = credentials.getRequestMetadata();
18351836
assertEquals(headers.get("x-allowed-locations"), Arrays.asList("0x80000"));
File renamed without changes.

0 commit comments

Comments
 (0)