Package com.google.auth.oauth2
Class IdentityPoolCredentials.Builder
- java.lang.Object
-
- com.google.auth.oauth2.OAuth2Credentials.Builder
-
- com.google.auth.oauth2.GoogleCredentials.Builder
-
- com.google.auth.oauth2.ExternalAccountCredentials.Builder
-
- com.google.auth.oauth2.IdentityPoolCredentials.Builder
-
- Enclosing class:
- IdentityPoolCredentials
public static class IdentityPoolCredentials.Builder extends ExternalAccountCredentials.Builder
-
-
Field Summary
Fields Modifier and Type Field Description private IdentityPoolSubjectTokenSuppliersubjectTokenSupplier-
Fields inherited from class com.google.auth.oauth2.ExternalAccountCredentials.Builder
audience, clientId, clientSecret, credentialSource, environmentProvider, metricsHandler, scopes, serviceAccountImpersonationOptions, serviceAccountImpersonationUrl, subjectTokenType, tokenInfoUrl, tokenUrl, transportFactory, universeDomain, workforcePoolUserProject
-
Fields inherited from class com.google.auth.oauth2.GoogleCredentials.Builder
quotaProjectId
-
-
Constructor Summary
Constructors Constructor Description Builder()Builder(IdentityPoolCredentials credentials)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IdentityPoolCredentialsbuild()IdentityPoolCredentials.BuildersetAudience(java.lang.String audience)Sets the Security Token Service audience, which is usually the fully specified resource name of the workload/workforce pool provider.IdentityPoolCredentials.BuildersetClientId(java.lang.String clientId)Sets the optional client ID of the service account from the console.IdentityPoolCredentials.BuildersetClientSecret(java.lang.String clientSecret)Sets the optional client secret of the service account from the console.IdentityPoolCredentials.BuildersetCredentialSource(IdentityPoolCredentialSource credentialSource)(package private) IdentityPoolCredentials.BuildersetEnvironmentProvider(EnvironmentProvider environmentProvider)Sets the optional Environment Provider.IdentityPoolCredentials.BuildersetHttpTransportFactory(HttpTransportFactory transportFactory)Sets the HTTP transport factory, creates the transport used to get access tokens.IdentityPoolCredentials.BuildersetQuotaProjectId(java.lang.String quotaProjectId)Sets the optional project used for quota and billing purposes.IdentityPoolCredentials.BuildersetScopes(java.util.Collection<java.lang.String> scopes)Sets the optional scopes to request during the authorization grant.IdentityPoolCredentials.BuildersetServiceAccountImpersonationOptions(java.util.Map<java.lang.String,java.lang.Object> optionsMap)Sets the optional service account impersonation options.IdentityPoolCredentials.BuildersetServiceAccountImpersonationUrl(java.lang.String serviceAccountImpersonationUrl)Sets the optional URL used for service account impersonation, which is required for some APIs.IdentityPoolCredentials.BuildersetSubjectTokenSupplier(IdentityPoolSubjectTokenSupplier subjectTokenSupplier)Sets the subject token supplier.IdentityPoolCredentials.BuildersetSubjectTokenType(ExternalAccountCredentials.SubjectTokenTypes subjectTokenType)Sets the Security Token Service subject token type based on the OAuth 2.0 token exchange spec.IdentityPoolCredentials.BuildersetSubjectTokenType(java.lang.String subjectTokenType)Sets the Security Token Service subject token type based on the OAuth 2.0 token exchange spec.IdentityPoolCredentials.BuildersetTokenInfoUrl(java.lang.String tokenInfoUrl)Sets the optional endpoint used to retrieve account related information.IdentityPoolCredentials.BuildersetTokenUrl(java.lang.String tokenUrl)Sets the Security Token Service token exchange endpoint.IdentityPoolCredentials.BuildersetUniverseDomain(java.lang.String universeDomain)Sets the optional universe domain.IdentityPoolCredentials.BuildersetWorkforcePoolUserProject(java.lang.String workforcePoolUserProject)Sets the optional workforce pool user project number when the credential corresponds to a workforce pool and not a workload identity pool.-
Methods inherited from class com.google.auth.oauth2.ExternalAccountCredentials.Builder
setCredentialSource
-
Methods inherited from class com.google.auth.oauth2.GoogleCredentials.Builder
getQuotaProjectId, getUniverseDomain, setAccessToken
-
Methods inherited from class com.google.auth.oauth2.OAuth2Credentials.Builder
getAccessToken, getExpirationMargin, getRefreshMargin, setExpirationMargin, setRefreshMargin
-
-
-
-
Field Detail
-
subjectTokenSupplier
private IdentityPoolSubjectTokenSupplier subjectTokenSupplier
-
-
Constructor Detail
-
Builder
Builder()
-
Builder
Builder(IdentityPoolCredentials credentials)
-
-
Method Detail
-
setSubjectTokenSupplier
@CanIgnoreReturnValue public IdentityPoolCredentials.Builder setSubjectTokenSupplier(IdentityPoolSubjectTokenSupplier subjectTokenSupplier)
Sets the subject token supplier. The supplier should return a valid subject token string.- Parameters:
subjectTokenSupplier- the supplier to use.- Returns:
- this
Builderobject
-
setHttpTransportFactory
@CanIgnoreReturnValue public IdentityPoolCredentials.Builder setHttpTransportFactory(HttpTransportFactory transportFactory)
Description copied from class:ExternalAccountCredentials.BuilderSets the HTTP transport factory, creates the transport used to get access tokens.- Overrides:
setHttpTransportFactoryin classExternalAccountCredentials.Builder- Parameters:
transportFactory- theHttpTransportFactoryto set- Returns:
- this
Builderobject
-
setAudience
@CanIgnoreReturnValue public IdentityPoolCredentials.Builder setAudience(java.lang.String audience)
Description copied from class:ExternalAccountCredentials.BuilderSets the Security Token Service audience, which is usually the fully specified resource name of the workload/workforce pool provider.- Overrides:
setAudiencein classExternalAccountCredentials.Builder- Parameters:
audience- the Security Token Service audience to set- Returns:
- this
Builderobject
-
setSubjectTokenType
@CanIgnoreReturnValue public IdentityPoolCredentials.Builder setSubjectTokenType(java.lang.String subjectTokenType)
Description copied from class:ExternalAccountCredentials.BuilderSets 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.- Overrides:
setSubjectTokenTypein classExternalAccountCredentials.Builder- Parameters:
subjectTokenType- the Security Token Service subject token type to set- Returns:
- this
Builderobject
-
setSubjectTokenType
@CanIgnoreReturnValue public IdentityPoolCredentials.Builder setSubjectTokenType(ExternalAccountCredentials.SubjectTokenTypes subjectTokenType)
Description copied from class:ExternalAccountCredentials.BuilderSets 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.- Overrides:
setSubjectTokenTypein classExternalAccountCredentials.Builder- Parameters:
subjectTokenType- theSubjectTokenTypeto set- Returns:
- this
Builderobject
-
setTokenUrl
@CanIgnoreReturnValue public IdentityPoolCredentials.Builder setTokenUrl(java.lang.String tokenUrl)
Description copied from class:ExternalAccountCredentials.BuilderSets the Security Token Service token exchange endpoint.- Overrides:
setTokenUrlin classExternalAccountCredentials.Builder- Parameters:
tokenUrl- the Security Token Service token exchange url to set- Returns:
- this
Builderobject
-
setCredentialSource
@CanIgnoreReturnValue public IdentityPoolCredentials.Builder setCredentialSource(IdentityPoolCredentialSource credentialSource)
-
setServiceAccountImpersonationUrl
@CanIgnoreReturnValue public IdentityPoolCredentials.Builder setServiceAccountImpersonationUrl(java.lang.String serviceAccountImpersonationUrl)
Description copied from class:ExternalAccountCredentials.BuilderSets 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.- Overrides:
setServiceAccountImpersonationUrlin classExternalAccountCredentials.Builder- Parameters:
serviceAccountImpersonationUrl- the service account impersonation url to set- Returns:
- this
Builderobject
-
setTokenInfoUrl
@CanIgnoreReturnValue public IdentityPoolCredentials.Builder setTokenInfoUrl(java.lang.String tokenInfoUrl)
Description copied from class:ExternalAccountCredentials.BuilderSets the optional endpoint used to retrieve account related information. Required for gCloud session account identification.- Overrides:
setTokenInfoUrlin classExternalAccountCredentials.Builder- Parameters:
tokenInfoUrl- the token info url to set- Returns:
- this
Builderobject
-
setQuotaProjectId
@CanIgnoreReturnValue public IdentityPoolCredentials.Builder setQuotaProjectId(java.lang.String quotaProjectId)
Description copied from class:ExternalAccountCredentials.BuilderSets the optional project used for quota and billing purposes.- Overrides:
setQuotaProjectIdin classExternalAccountCredentials.Builder- Parameters:
quotaProjectId- the quota and billing project id to set- Returns:
- this
Builderobject
-
setClientId
@CanIgnoreReturnValue public IdentityPoolCredentials.Builder setClientId(java.lang.String clientId)
Description copied from class:ExternalAccountCredentials.BuilderSets the optional client ID of the service account from the console.- Overrides:
setClientIdin classExternalAccountCredentials.Builder- Parameters:
clientId- the service account client id to set- Returns:
- this
Builderobject
-
setClientSecret
@CanIgnoreReturnValue public IdentityPoolCredentials.Builder setClientSecret(java.lang.String clientSecret)
Description copied from class:ExternalAccountCredentials.BuilderSets the optional client secret of the service account from the console.- Overrides:
setClientSecretin classExternalAccountCredentials.Builder- Parameters:
clientSecret- the service account client secret to set- Returns:
- this
Builderobject
-
setScopes
@CanIgnoreReturnValue public IdentityPoolCredentials.Builder setScopes(java.util.Collection<java.lang.String> scopes)
Description copied from class:ExternalAccountCredentials.BuilderSets the optional scopes to request during the authorization grant.- Overrides:
setScopesin classExternalAccountCredentials.Builder- Parameters:
scopes- the request scopes to set- Returns:
- this
Builderobject
-
setWorkforcePoolUserProject
@CanIgnoreReturnValue public IdentityPoolCredentials.Builder setWorkforcePoolUserProject(java.lang.String workforcePoolUserProject)
Description copied from class:ExternalAccountCredentials.BuilderSets 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.- Overrides:
setWorkforcePoolUserProjectin classExternalAccountCredentials.Builder- Parameters:
workforcePoolUserProject- the workforce pool user project number to set- Returns:
- this
Builderobject
-
setServiceAccountImpersonationOptions
@CanIgnoreReturnValue public IdentityPoolCredentials.Builder setServiceAccountImpersonationOptions(java.util.Map<java.lang.String,java.lang.Object> optionsMap)
Description copied from class:ExternalAccountCredentials.BuilderSets the optional service account impersonation options.- Overrides:
setServiceAccountImpersonationOptionsin classExternalAccountCredentials.Builder- Parameters:
optionsMap- the service account impersonation options to set- Returns:
- this
Builderobject
-
setUniverseDomain
@CanIgnoreReturnValue public IdentityPoolCredentials.Builder setUniverseDomain(java.lang.String universeDomain)
Description copied from class:ExternalAccountCredentials.BuilderSets the optional universe domain.- Overrides:
setUniverseDomainin classExternalAccountCredentials.Builder- Parameters:
universeDomain- the universe domain to set- Returns:
- this
Builderobject
-
setEnvironmentProvider
@CanIgnoreReturnValue IdentityPoolCredentials.Builder setEnvironmentProvider(EnvironmentProvider environmentProvider)
Description copied from class:ExternalAccountCredentials.BuilderSets the optional Environment Provider.- Overrides:
setEnvironmentProviderin classExternalAccountCredentials.Builder- Parameters:
environmentProvider- theEnvironmentProviderto set- Returns:
- this
Builderobject
-
build
public IdentityPoolCredentials build()
- Specified by:
buildin classExternalAccountCredentials.Builder
-
-