Class ExternalAccountAuthorizedUserCredentials (1.19.0)

public class ExternalAccountAuthorizedUserCredentials extends GoogleCredentials

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

Static Methods

fromStream(InputStream credentialsStream)

public static ExternalAccountAuthorizedUserCredentials fromStream(InputStream credentialsStream)

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

Parameter
NameDescription
credentialsStreamInputStream

the stream with the credential definition

Returns
TypeDescription
ExternalAccountAuthorizedUserCredentials

the credential defined by the credentialsStream

Exceptions
TypeDescription
IOException

if the credential cannot be created from the stream

fromStream(InputStream credentialsStream, HttpTransportFactory transportFactory)

public static ExternalAccountAuthorizedUserCredentials fromStream(InputStream credentialsStream, HttpTransportFactory transportFactory)

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

Parameters
NameDescription
credentialsStreamInputStream

the stream with the credential definition

transportFactoryHttpTransportFactory

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

Returns
TypeDescription
ExternalAccountAuthorizedUserCredentials

the credential defined by the credentialsStream

Exceptions
TypeDescription
IOException

if the credential cannot be created from the stream

newBuilder()

public static ExternalAccountAuthorizedUserCredentials.Builder newBuilder()
Returns
TypeDescription
ExternalAccountAuthorizedUserCredentials.Builder

Methods

equals(Object obj)

public boolean equals(Object obj)
Parameter
NameDescription
objObject
Returns
TypeDescription
boolean
Overrides

getAudience()

public String getAudience()
Returns
TypeDescription
String

getClientId()

public String getClientId()
Returns
TypeDescription
String

getClientSecret()

public String getClientSecret()
Returns
TypeDescription
String

getRefreshToken()

public String getRefreshToken()
Returns
TypeDescription
String

getRevokeUrl()

public String getRevokeUrl()
Returns
TypeDescription
String

getTokenInfoUrl()

public String getTokenInfoUrl()
Returns
TypeDescription
String

getTokenUrl()

public String getTokenUrl()
Returns
TypeDescription
String

hashCode()

public int hashCode()
Returns
TypeDescription
int
Overrides

refreshAccessToken()

public AccessToken refreshAccessToken()

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
TypeDescription
AccessToken
Overrides
Exceptions
TypeDescription
IOException

toBuilder()

public ExternalAccountAuthorizedUserCredentials.Builder toBuilder()
Returns
TypeDescription
ExternalAccountAuthorizedUserCredentials.Builder
Overrides

toString()

public String toString()
Returns
TypeDescription
String
Overrides