@@ -159,9 +159,25 @@ protected ExternalAccountCredentials(
159159 }
160160
161161 /**
162- * See {@link ExternalAccountCredentials#ExternalAccountCredentials(HttpTransportFactory, String,
163- * String, String, CredentialSource, String, String, String, String, String, Collection)}
162+ * Constructor with minimum identifying information and custom HTTP transport. Does not support
163+ * workforce credentials.
164164 *
165+ * @param transportFactory HTTP transport factory, creates the transport used to get access tokens
166+ * @param audience the Security Token Service audience, which is usually the fully specified
167+ * resource name of the workload/workforce pool provider
168+ * @param subjectTokenType the Security Token Service subject token type based on the OAuth 2.0
169+ * token exchange spec. Indicates the type of the security token in the credential file
170+ * @param tokenUrl the Security Token Service token exchange endpoint
171+ * @param tokenInfoUrl the endpoint used to retrieve account related information. Required for
172+ * gCloud session account identification.
173+ * @param credentialSource the external credential source
174+ * @param serviceAccountImpersonationUrl the URL for the service account impersonation request.
175+ * This URL is required for some APIs. If this URL is not available, the access token from the
176+ * Security Token Service is used directly. May be null.
177+ * @param quotaProjectId the project used for quota and billing purposes. May be null.
178+ * @param clientId client ID of the service account from the console. May be null.
179+ * @param clientSecret client secret of the service account from the console. May be null.
180+ * @param scopes the scopes to request during the authorization grant. May be null.
165181 * @param environmentProvider the environment provider. May be null. Defaults to {@link
166182 * SystemEnvironmentProvider}.
167183 */
@@ -211,6 +227,8 @@ protected ExternalAccountCredentials(
211227 /**
212228 * Internal constructor with minimum identifying information and custom HTTP transport. See {@link
213229 * ExternalAccountCredentials.Builder}.
230+ *
231+ * @param builder the {@code Builder} object used to construct the credentials.
214232 */
215233 protected ExternalAccountCredentials (ExternalAccountCredentials .Builder builder ) {
216234 this .transportFactory =
@@ -494,6 +512,7 @@ protected AccessToken exchangeExternalCredentialForAccessToken(
494512 * source.
495513 *
496514 * @return the external subject token
515+ * @throws IOException if the subject token cannot be retrieved
497516 */
498517 public abstract String retrieveSubjectToken () throws IOException ;
499518
@@ -522,7 +541,7 @@ public String getServiceAccountImpersonationUrl() {
522541 return serviceAccountImpersonationUrl ;
523542 }
524543
525- /** The service account email to be impersonated, if available. */
544+ /** @return The service account email to be impersonated, if available */
526545 @ Nullable
527546 public String getServiceAccountEmail () {
528547 if (serviceAccountImpersonationUrl == null || serviceAccountImpersonationUrl .isEmpty ()) {
@@ -567,8 +586,8 @@ EnvironmentProvider getEnvironmentProvider() {
567586 }
568587
569588 /**
570- * Returns whether the current configuration is for Workforce Pools (which enable 3p user
571- * identities, rather than workloads).
589+ * @return whether the current configuration is for Workforce Pools (which enable 3p user
590+ * identities, rather than workloads)
572591 */
573592 public boolean isWorkforcePoolConfiguration () {
574593 Pattern workforceAudiencePattern =
@@ -728,7 +747,12 @@ protected Builder(ExternalAccountCredentials credentials) {
728747 this .serviceAccountImpersonationOptions = credentials .serviceAccountImpersonationOptions ;
729748 }
730749
731- /** Sets the HTTP transport factory, creates the transport used to get access tokens. */
750+ /**
751+ * Sets the HTTP transport factory, creates the transport used to get access tokens.
752+ *
753+ * @param transportFactory the {@code HttpTransportFactory} to set
754+ * @return this {@code Builder} object
755+ */
732756 public Builder setHttpTransportFactory (HttpTransportFactory transportFactory ) {
733757 this .transportFactory = transportFactory ;
734758 return this ;
@@ -737,6 +761,9 @@ public Builder setHttpTransportFactory(HttpTransportFactory transportFactory) {
737761 /**
738762 * Sets the Security Token Service audience, which is usually the fully specified resource name
739763 * of the workload/workforce pool provider.
764+ *
765+ * @param audience the Security Token Service audience to set
766+ * @return this {@code Builder} object
740767 */
741768 public Builder setAudience (String audience ) {
742769 this .audience = audience ;
@@ -746,19 +773,32 @@ public Builder setAudience(String audience) {
746773 /**
747774 * Sets the Security Token Service subject token type based on the OAuth 2.0 token exchange
748775 * spec. Indicates the type of the security token in the credential file.
776+ *
777+ * @param subjectTokenType the Security Token Service subject token type to set
778+ * @return this {@code Builder} object
749779 */
750780 public Builder setSubjectTokenType (String subjectTokenType ) {
751781 this .subjectTokenType = subjectTokenType ;
752782 return this ;
753783 }
754784
755- /** Sets the Security Token Service token exchange endpoint. */
785+ /**
786+ * Sets the Security Token Service token exchange endpoint.
787+ *
788+ * @param tokenUrl the Security Token Service token exchange url to set
789+ * @return this {@code Builder} object
790+ */
756791 public Builder setTokenUrl (String tokenUrl ) {
757792 this .tokenUrl = tokenUrl ;
758793 return this ;
759794 }
760795
761- /** Sets the external credential source. */
796+ /**
797+ * Sets the external credential source.
798+ *
799+ * @param credentialSource the {@code CredentialSource} to set
800+ * @return this {@code Builder} object
801+ */
762802 public Builder setCredentialSource (CredentialSource credentialSource ) {
763803 this .credentialSource = credentialSource ;
764804 return this ;
@@ -768,6 +808,9 @@ public Builder setCredentialSource(CredentialSource credentialSource) {
768808 * Sets the optional URL used for service account impersonation, which is required for some
769809 * APIs. If this URL is not available, the access token from the Security Token Service is used
770810 * directly.
811+ *
812+ * @param serviceAccountImpersonationUrl the service account impersonation url to set
813+ * @return this {@code Builder} object
771814 */
772815 public Builder setServiceAccountImpersonationUrl (String serviceAccountImpersonationUrl ) {
773816 this .serviceAccountImpersonationUrl = serviceAccountImpersonationUrl ;
@@ -777,31 +820,54 @@ public Builder setServiceAccountImpersonationUrl(String serviceAccountImpersonat
777820 /**
778821 * Sets the optional endpoint used to retrieve account related information. Required for gCloud
779822 * session account identification.
823+ *
824+ * @param tokenInfoUrl the token info url to set
825+ * @return this {@code Builder} object
780826 */
781827 public Builder setTokenInfoUrl (String tokenInfoUrl ) {
782828 this .tokenInfoUrl = tokenInfoUrl ;
783829 return this ;
784830 }
785831
786- /** Sets the optional project used for quota and billing purposes. */
832+ /**
833+ * Sets the optional project used for quota and billing purposes.
834+ *
835+ * @param quotaProjectId the quota and billing project id to set
836+ * @return this {@code Builder} object
837+ */
787838 public Builder setQuotaProjectId (String quotaProjectId ) {
788839 this .quotaProjectId = quotaProjectId ;
789840 return this ;
790841 }
791842
792- /** Sets the optional client ID of the service account from the console. */
843+ /**
844+ * Sets the optional client ID of the service account from the console.
845+ *
846+ * @param clientId the service account client id to set
847+ * @return this {@code Builder} object
848+ */
793849 public Builder setClientId (String clientId ) {
794850 this .clientId = clientId ;
795851 return this ;
796852 }
797853
798- /** Sets the optional client secret of the service account from the console. */
854+ /**
855+ * Sets the optional client secret of the service account from the console.
856+ *
857+ * @param clientSecret the service account client secret to set
858+ * @return this {@code Builder} object
859+ */
799860 public Builder setClientSecret (String clientSecret ) {
800861 this .clientSecret = clientSecret ;
801862 return this ;
802863 }
803864
804- /** Sets the optional scopes to request during the authorization grant. */
865+ /**
866+ * Sets the optional scopes to request during the authorization grant.
867+ *
868+ * @param scopes the request scopes to set
869+ * @return this {@code Builder} object
870+ */
805871 public Builder setScopes (Collection <String > scopes ) {
806872 this .scopes = scopes ;
807873 return this ;
@@ -811,18 +877,32 @@ public Builder setScopes(Collection<String> scopes) {
811877 * Sets the optional workforce pool user project number when the credential corresponds to a
812878 * workforce pool and not a workload identity pool. The underlying principal must still have
813879 * serviceusage.services.use IAM permission to use the project for billing/quota.
880+ *
881+ * @param workforcePoolUserProject the workforce pool user project number to set
882+ * @return this {@code Builder} object
814883 */
815884 public Builder setWorkforcePoolUserProject (String workforcePoolUserProject ) {
816885 this .workforcePoolUserProject = workforcePoolUserProject ;
817886 return this ;
818887 }
819888
820- /** Sets the optional service account impersonation options. */
889+ /**
890+ * Sets the optional service account impersonation options.
891+ *
892+ * @param optionsMap the service account impersonation options to set
893+ * @return this {@code Builder} object
894+ */
821895 public Builder setServiceAccountImpersonationOptions (Map <String , Object > optionsMap ) {
822896 this .serviceAccountImpersonationOptions = new ServiceAccountImpersonationOptions (optionsMap );
823897 return this ;
824898 }
825899
900+ /**
901+ * Sets the optional Environment Provider.
902+ *
903+ * @param environmentProvider the {@code EnvironmentProvider} to set
904+ * @return this {@code Builder} object
905+ */
826906 Builder setEnvironmentProvider (EnvironmentProvider environmentProvider ) {
827907 this .environmentProvider = environmentProvider ;
828908 return this ;
0 commit comments