Class ExternalAccountAuthorizedUserCredentials (1.20.0)

publicclass ExternalAccountAuthorizedUserCredentialsextendsGoogleCredentials

OAuth2 credentials sourced using external identities through Workforce Identity Federation.

Obtaining the initial access and refresh token can be done through the Google Cloud CLI.

Example credentials file: { "type": "external_account_authorized_user", "audience": "//iam.googleapis.com/locations/global/workforcePools/$WORKFORCE_POOL_ID/providers/$PROVIDER_ID", "refresh_token": "refreshToken", "token_url": "https://sts.googleapis.com/v1/oauthtoken", "token_info_url": "https://sts.googleapis.com/v1/introspect", "client_id": "clientId", "client_secret": "clientSecret" }

Inheritance

Object > Credentials > OAuth2Credentials > GoogleCredentials > ExternalAccountAuthorizedUserCredentials

Inherited Members

Static Methods

fromStream(InputStream credentialsStream)

publicstaticExternalAccountAuthorizedUserCredentialsfromStream(InputStreamcredentialsStream)

Returns external account authorized user credentials defined by a JSON file stream.

Parameter
Name Description
credentialsStream InputStream

the stream with the credential definition

Returns
Type Description
ExternalAccountAuthorizedUserCredentials

the credential defined by the credentialsStream

Exceptions
Type Description
IOException

if the credential cannot be created from the stream

fromStream(InputStream credentialsStream, HttpTransportFactory transportFactory)

publicstaticExternalAccountAuthorizedUserCredentialsfromStream(InputStreamcredentialsStream,HttpTransportFactorytransportFactory)

Returns external account authorized user credentials defined by a JSON file stream.

Parameters
Name Description
credentialsStream InputStream

the stream with the credential definition

transportFactory HttpTransportFactory

the HTTP transport factory used to create the transport to get access tokens

Returns
Type Description
ExternalAccountAuthorizedUserCredentials

the credential defined by the credentialsStream

Exceptions
Type Description
IOException

if the credential cannot be created from the stream

newBuilder()

publicstaticExternalAccountAuthorizedUserCredentials.BuildernewBuilder()
Returns
Type Description
ExternalAccountAuthorizedUserCredentials.Builder

Methods

equals(Object obj)

publicbooleanequals(Objectobj)
Parameter
Name Description
obj Object
Returns
Type Description
boolean
Overrides

getAudience()

publicStringgetAudience()
Returns
Type Description
String

getClientId()

publicStringgetClientId()
Returns
Type Description
String

getClientSecret()

publicStringgetClientSecret()
Returns
Type Description
String

getRefreshToken()

publicStringgetRefreshToken()
Returns
Type Description
String

getRevokeUrl()

publicStringgetRevokeUrl()
Returns
Type Description
String

getTokenInfoUrl()

publicStringgetTokenInfoUrl()
Returns
Type Description
String

getTokenUrl()

publicStringgetTokenUrl()
Returns
Type Description
String

hashCode()

publicinthashCode()
Returns
Type Description
int
Overrides

refreshAccessToken()

publicAccessTokenrefreshAccessToken()

Method to refresh the access token according to the specific type of credentials.

Throws IllegalStateException if not overridden since direct use of OAuth2Credentials is only for temporary or non-refreshing access tokens.

Returns
Type Description
AccessToken
Overrides
Exceptions
Type Description
IOException

toBuilder()

publicExternalAccountAuthorizedUserCredentials.BuildertoBuilder()
Returns
Type Description
ExternalAccountAuthorizedUserCredentials.Builder
Overrides

toString()

publicStringtoString()
Returns
Type Description
String
Overrides

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年10月30日 UTC.