Skip to content

Commit 202c1d5

Browse files
committed
rely on gax for validation
1 parent 0a72e9a commit 202c1d5

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,7 @@ private ServiceAccountJwtAccessCredentials(
141141
this.defaultAudience = defaultAudience;
142142
this.credentialsCache = createCache();
143143
this.quotaProjectId = quotaProjectId;
144-
if (universeDomain == null || universeDomain.trim().isEmpty()) {
145-
this.universeDomain = Credentials.GOOGLE_DEFAULT_UNIVERSE;
146-
} else {
147-
this.universeDomain = universeDomain;
148-
}
144+
this.universeDomain = universeDomain;
149145
}
150146

151147
/**
@@ -437,6 +433,7 @@ public final String getPrivateKeyId() {
437433
return privateKeyId;
438434
}
439435

436+
/** Returns the universe domain (example, googleapis.com) for the credentials instance. */
440437
@Override
441438
public final String getUniverseDomain() {
442439
return universeDomain;
@@ -568,6 +565,7 @@ public Builder setQuotaProjectId(String quotaProjectId) {
568565
}
569566

570567
@CanIgnoreReturnValue
568+
/** Sets the universe domain (example, googleapis.com). */
571569
public Builder setUniverseDomain(String universeDomain) {
572570
this.universeDomain = universeDomain;
573571
return this;
@@ -597,6 +595,7 @@ public String getQuotaProjectId() {
597595
return quotaProjectId;
598596
}
599597

598+
/** Returns the universe domain (example, googleapis.com) for the credentials instance. */
600599
public String getUniverseDomain() {
601600
return universeDomain;
602601
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public void constructor_allParameters_constructs() throws IOException {
113113
assertEquals(privateKey, credentials.getPrivateKey());
114114
assertEquals(SA_PRIVATE_KEY_ID, credentials.getPrivateKeyId());
115115
assertEquals(QUOTA_PROJECT, credentials.getQuotaProjectId());
116-
assertEquals(GOOGLE_DEFAULT_UNIVERSE, credentials.getUniverseDomain());
116+
assertNull(credentials.getUniverseDomain());
117117
}
118118

119119
@Test
@@ -917,7 +917,7 @@ public void builder_defaultUniverseDomain() throws IOException {
917917
.setPrivateKeyId(SA_PRIVATE_KEY_ID)
918918
.setDefaultAudience(URI.create("default-audience"))
919919
.build();
920-
assertEquals(GOOGLE_DEFAULT_UNIVERSE, credentials.getUniverseDomain());
920+
assertNull(credentials.getUniverseDomain());
921921
}
922922

923923
@Test

0 commit comments

Comments
 (0)