Class ExternalAccountCredentials.Builder (1.18.0)

public abstract static class ExternalAccountCredentials.Builder extends GoogleCredentials.Builder

Base builder for external account credentials.

Inheritance

java.lang.Object > OAuth2Credentials.Builder > GoogleCredentials.Builder > ExternalAccountCredentials.Builder

Constructors

Builder()

protected Builder()

Builder(ExternalAccountCredentials credentials)

protected Builder(ExternalAccountCredentials credentials)
Parameter
NameDescription
credentialsExternalAccountCredentials

Fields

audience

protected String audience
Field Value
TypeDescription
String

clientId

protected String clientId
Field Value
TypeDescription
String

clientSecret

protected String clientSecret
Field Value
TypeDescription
String

credentialSource

protected ExternalAccountCredentials.CredentialSource credentialSource
Field Value
TypeDescription
com.google.auth.oauth2.ExternalAccountCredentials.CredentialSource

environmentProvider

protected EnvironmentProvider environmentProvider
Field Value
TypeDescription
com.google.auth.oauth2.EnvironmentProvider

scopes

protected Collection<String> scopes
Field Value
TypeDescription
Collection<String>

serviceAccountImpersonationOptions

protected ExternalAccountCredentials.ServiceAccountImpersonationOptions serviceAccountImpersonationOptions
Field Value
TypeDescription
com.google.auth.oauth2.ExternalAccountCredentials.ServiceAccountImpersonationOptions

serviceAccountImpersonationUrl

protected String serviceAccountImpersonationUrl
Field Value
TypeDescription
String

subjectTokenType

protected String subjectTokenType
Field Value
TypeDescription
String

tokenInfoUrl

protected String tokenInfoUrl
Field Value
TypeDescription
String

tokenUrl

protected String tokenUrl
Field Value
TypeDescription
String

transportFactory

protected HttpTransportFactory transportFactory
Field Value
TypeDescription
HttpTransportFactory

universeDomain

protected String universeDomain
Field Value
TypeDescription
String

workforcePoolUserProject

protected String workforcePoolUserProject
Field Value
TypeDescription
String

Methods

build()

public abstract ExternalAccountCredentials build()
Returns
TypeDescription
ExternalAccountCredentials
Overrides

setAudience(String audience)

public ExternalAccountCredentials.Builder setAudience(String audience)

Sets the Security Token Service audience, which is usually the fully specified resource name of the workload/workforce pool provider.

Parameter
NameDescription
audienceString

the Security Token Service audience to set

Returns
TypeDescription
ExternalAccountCredentials.Builder

this Builder object

setClientId(String clientId)

public ExternalAccountCredentials.Builder setClientId(String clientId)

Sets the optional client ID of the service account from the console.

Parameter
NameDescription
clientIdString

the service account client id to set

Returns
TypeDescription
ExternalAccountCredentials.Builder

this Builder object

setClientSecret(String clientSecret)

public ExternalAccountCredentials.Builder setClientSecret(String clientSecret)

Sets the optional client secret of the service account from the console.

Parameter
NameDescription
clientSecretString

the service account client secret to set

Returns
TypeDescription
ExternalAccountCredentials.Builder

this Builder object

setCredentialSource(ExternalAccountCredentials.CredentialSource credentialSource)

public ExternalAccountCredentials.Builder setCredentialSource(ExternalAccountCredentials.CredentialSource credentialSource)

Sets the external credential source.

Parameter
NameDescription
credentialSourcecom.google.auth.oauth2.ExternalAccountCredentials.CredentialSource

the CredentialSource to set

Returns
TypeDescription
ExternalAccountCredentials.Builder

this Builder object

setHttpTransportFactory(HttpTransportFactory transportFactory)

public ExternalAccountCredentials.Builder setHttpTransportFactory(HttpTransportFactory transportFactory)

Sets the HTTP transport factory, creates the transport used to get access tokens.

Parameter
NameDescription
transportFactoryHttpTransportFactory

the HttpTransportFactory to set

Returns
TypeDescription
ExternalAccountCredentials.Builder

this Builder object

setQuotaProjectId(String quotaProjectId)

public ExternalAccountCredentials.Builder setQuotaProjectId(String quotaProjectId)

Sets the optional project used for quota and billing purposes.

Parameter
NameDescription
quotaProjectIdString

the quota and billing project id to set

Returns
TypeDescription
ExternalAccountCredentials.Builder

this Builder object

Overrides

setScopes(Collection<String> scopes)

public ExternalAccountCredentials.Builder setScopes(Collection<String> scopes)

Sets the optional scopes to request during the authorization grant.

Parameter
NameDescription
scopesCollection<String>

the request scopes to set

Returns
TypeDescription
ExternalAccountCredentials.Builder

this Builder object

setServiceAccountImpersonationOptions(Map<String,Object> optionsMap)

public ExternalAccountCredentials.Builder setServiceAccountImpersonationOptions(Map<String,Object> optionsMap)

Sets the optional service account impersonation options.

Parameter
NameDescription
optionsMapMap<String,Object>

the service account impersonation options to set

Returns
TypeDescription
ExternalAccountCredentials.Builder

this Builder object

setServiceAccountImpersonationUrl(String serviceAccountImpersonationUrl)

public ExternalAccountCredentials.Builder setServiceAccountImpersonationUrl(String serviceAccountImpersonationUrl)

Sets the optional URL used for service account impersonation, which is required for some APIs. If this URL is not available, the access token from the Security Token Service is used directly.

Parameter
NameDescription
serviceAccountImpersonationUrlString

the service account impersonation url to set

Returns
TypeDescription
ExternalAccountCredentials.Builder

this Builder object

setSubjectTokenType(String subjectTokenType)

public ExternalAccountCredentials.Builder setSubjectTokenType(String subjectTokenType)

Sets the Security Token Service subject token type based on the OAuth 2.0 token exchange spec. Indicates the type of the security token in the credential file.

Parameter
NameDescription
subjectTokenTypeString

the Security Token Service subject token type to set

Returns
TypeDescription
ExternalAccountCredentials.Builder

this Builder object

setTokenInfoUrl(String tokenInfoUrl)

public ExternalAccountCredentials.Builder setTokenInfoUrl(String tokenInfoUrl)

Sets the optional endpoint used to retrieve account related information. Required for gCloud session account identification.

Parameter
NameDescription
tokenInfoUrlString

the token info url to set

Returns
TypeDescription
ExternalAccountCredentials.Builder

this Builder object

setTokenUrl(String tokenUrl)

public ExternalAccountCredentials.Builder setTokenUrl(String tokenUrl)

Sets the Security Token Service token exchange endpoint.

Parameter
NameDescription
tokenUrlString

the Security Token Service token exchange url to set

Returns
TypeDescription
ExternalAccountCredentials.Builder

this Builder object

setUniverseDomain(String universeDomain)

public ExternalAccountCredentials.Builder setUniverseDomain(String universeDomain)

Sets the optional universe domain.

Parameter
NameDescription
universeDomainString

the universe domain to set

Returns
TypeDescription
ExternalAccountCredentials.Builder

this Builder object

setWorkforcePoolUserProject(String workforcePoolUserProject)

public ExternalAccountCredentials.Builder setWorkforcePoolUserProject(String workforcePoolUserProject)

Sets the optional workforce pool user project number when the credential corresponds to a workforce pool and not a workload identity pool. The underlying principal must still have serviceusage.services.use IAM permission to use the project for billing/quota.

Parameter
NameDescription
workforcePoolUserProjectString

the workforce pool user project number to set

Returns
TypeDescription
ExternalAccountCredentials.Builder

this Builder object