Skip to content

Commit 0200dbb

Browse files
authored
fix: update branding in ExternalAccountCredentials (googleapis#893)
These changes align the Javadoc comments with the branding that Google uses externally: + STS -> Security Token Service + GCP -> Google Cloud + Remove references to a Google-internal token type Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/google-auth-library-java/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass: Tests are failing, but I don't think that was caused by the changes in this PR - [ ] Code coverage does not decrease (if any source code was changed): n/a - [ ] Appropriate docs were updated (if necessary): n/a
1 parent cc670a4 commit 0200dbb

File tree

1 file changed

+27
-25
lines changed

1 file changed

+27
-25
lines changed

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

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@
5858
/**
5959
* Base external account credentials class.
6060
*
61-
* <p>Handles initializing external credentials, calls to STS, and service account impersonation.
61+
* <p>Handles initializing external credentials, calls to the Security Token Service, and service
62+
* account impersonation.
6263
*/
6364
public abstract class ExternalAccountCredentials extends GoogleCredentials
6465
implements QuotaProjectIdProvider {
@@ -89,8 +90,9 @@ abstract static class CredentialSource {
8990
@Nullable private final String clientId;
9091
@Nullable private final String clientSecret;
9192

92-
// This is used for Workforce Pools. It is passed to STS during token exchange in the
93-
// `options` param and will be embedded in the token by STS.
93+
// This is used for Workforce Pools. It is passed to the Security Token Service during token
94+
// exchange in the `options` param and will be embedded in the token by the Security Token
95+
// Service.
9496
@Nullable private final String workforcePoolUserProject;
9597

9698
protected transient HttpTransportFactory transportFactory;
@@ -104,18 +106,17 @@ abstract static class CredentialSource {
104106
* workforce credentials.
105107
*
106108
* @param transportFactory HTTP transport factory, creates the transport used to get access tokens
107-
* @param audience the STS audience which is usually the fully specified resource name of the
108-
* workload/workforce pool provider
109-
* @param subjectTokenType the STS subject token type based on the OAuth 2.0 token exchange spec.
110-
* Indicates the type of the security token in the credential file
111-
* @param tokenUrl the STS token exchange endpoint
109+
* @param audience the Security Token Service audience, which is usually the fully specified
110+
* resource name of the workload/workforce pool provider
111+
* @param subjectTokenType the Security Token Service subject token type based on the OAuth 2.0
112+
* token exchange spec. Indicates the type of the security token in the credential file
113+
* @param tokenUrl the Security Token Service token exchange endpoint
112114
* @param tokenInfoUrl the endpoint used to retrieve account related information. Required for
113115
* gCloud session account identification.
114116
* @param credentialSource the external credential source
115117
* @param serviceAccountImpersonationUrl the URL for the service account impersonation request.
116-
* This is only required for workload identity pools when APIs to be accessed have not
117-
* integrated with UberMint. If this is not available, the STS returned GCP access token is
118-
* directly used. May be null.
118+
* This URL is required for some APIs. If this URL is not available, the access token from the
119+
* Security Token Service is used directly. May be null.
119120
* @param quotaProjectId the project used for quota and billing purposes. May be null.
120121
* @param clientId client ID of the service account from the console. May be null.
121122
* @param clientSecret client secret of the service account from the console. May be null.
@@ -395,11 +396,11 @@ private static boolean isAwsCredential(Map<String, Object> credentialSource) {
395396
}
396397

397398
/**
398-
* Exchanges the external credential for a GCP access token.
399+
* Exchanges the external credential for a Google Cloud access token.
399400
*
400-
* @param stsTokenExchangeRequest the STS token exchange request
401-
* @return the access token returned by STS
402-
* @throws OAuthException if the call to STS fails
401+
* @param stsTokenExchangeRequest the Security Token Service token exchange request
402+
* @return the access token returned by the Security Token Service
403+
* @throws OAuthException if the call to the Security Token Service fails
403404
*/
404405
protected AccessToken exchangeExternalCredentialForAccessToken(
405406
StsTokenExchangeRequest stsTokenExchangeRequest) throws IOException {
@@ -413,7 +414,8 @@ protected AccessToken exchangeExternalCredentialForAccessToken(
413414
tokenUrl, stsTokenExchangeRequest, transportFactory.create().createRequestFactory());
414415

415416
// If this credential was initialized with a Workforce configuration then the
416-
// workforcePoolUserProject must passed to STS via the the internal options param.
417+
// workforcePoolUserProject must be passed to the Security Token Service via the internal
418+
// options param.
417419
if (isWorkforcePoolConfiguration()) {
418420
GenericJson options = new GenericJson();
419421
options.setFactory(OAuth2Utils.JSON_FACTORY);
@@ -431,7 +433,7 @@ protected AccessToken exchangeExternalCredentialForAccessToken(
431433
}
432434

433435
/**
434-
* Retrieves the external subject token to be exchanged for a GCP access token.
436+
* Retrieves the external subject token to be exchanged for a Google Cloud access token.
435437
*
436438
* <p>Must be implemented by subclasses as the retrieval method is dependent on the credential
437439
* source.
@@ -603,24 +605,24 @@ public Builder setHttpTransportFactory(HttpTransportFactory transportFactory) {
603605
}
604606

605607
/**
606-
* Sets the STS audience which is usually the fully specified resource name of the
607-
* workload/workforce pool provider.
608+
* Sets the Security Token Service audience, which is usually the fully specified resource name
609+
* of the workload/workforce pool provider.
608610
*/
609611
public Builder setAudience(String audience) {
610612
this.audience = audience;
611613
return this;
612614
}
613615

614616
/**
615-
* Sets the STS subject token type based on the OAuth 2.0 token exchange spec. Indicates the
616-
* type of the security token in the credential file.
617+
* Sets the Security Token Service subject token type based on the OAuth 2.0 token exchange
618+
* spec. Indicates the type of the security token in the credential file.
617619
*/
618620
public Builder setSubjectTokenType(String subjectTokenType) {
619621
this.subjectTokenType = subjectTokenType;
620622
return this;
621623
}
622624

623-
/** Sets the STS token exchange endpoint. */
625+
/** Sets the Security Token Service token exchange endpoint. */
624626
public Builder setTokenUrl(String tokenUrl) {
625627
this.tokenUrl = tokenUrl;
626628
return this;
@@ -633,9 +635,9 @@ public Builder setCredentialSource(CredentialSource credentialSource) {
633635
}
634636

635637
/**
636-
* Sets the optional URL used for service account impersonation. This is only required when APIs
637-
* to be accessed have not integrated with UberMint. If this is not available, the STS returned
638-
* GCP access token is directly used.
638+
* Sets the optional URL used for service account impersonation, which is required for some
639+
* APIs. If this URL is not available, the access token from the Security Token Service is used
640+
* directly.
639641
*/
640642
public Builder setServiceAccountImpersonationUrl(String serviceAccountImpersonationUrl) {
641643
this.serviceAccountImpersonationUrl = serviceAccountImpersonationUrl;

0 commit comments

Comments
 (0)