Package com.google.auth.oauth2
Class ExternalAccountAuthorizedUserCredentials
- java.lang.Object
-
- com.google.auth.Credentials
-
- com.google.auth.oauth2.OAuth2Credentials
-
- com.google.auth.oauth2.GoogleCredentials
-
- com.google.auth.oauth2.ExternalAccountAuthorizedUserCredentials
-
- All Implemented Interfaces:
QuotaProjectIdProvider
,Serializable
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" }
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ExternalAccountAuthorizedUserCredentials.Builder
Builder forExternalAccountAuthorizedUserCredentials
.-
Nested classes/interfaces inherited from class com.google.auth.oauth2.OAuth2Credentials
OAuth2Credentials.CredentialsChangedListener
-
-
Field Summary
-
Fields inherited from class com.google.auth.oauth2.GoogleCredentials
quotaProjectId
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
static ExternalAccountAuthorizedUserCredentials
fromStream(InputStream credentialsStream)
Returns external account authorized user credentials defined by a JSON file stream.static ExternalAccountAuthorizedUserCredentials
fromStream(InputStream credentialsStream, HttpTransportFactory transportFactory)
Returns external account authorized user credentials defined by a JSON file stream.String
getAudience()
String
getClientId()
String
getClientSecret()
String
getRefreshToken()
String
getRevokeUrl()
String
getTokenInfoUrl()
String
getTokenUrl()
int
hashCode()
static ExternalAccountAuthorizedUserCredentials.Builder
newBuilder()
AccessToken
refreshAccessToken()
Method to refresh the access token according to the specific type of credentials.ExternalAccountAuthorizedUserCredentials.Builder
toBuilder()
String
toString()
-
Methods inherited from class com.google.auth.oauth2.GoogleCredentials
create, createDelegated, createScoped, createScoped, createScoped, createScopedRequired, createWithCustomRetryStrategy, createWithQuotaProject, getAdditionalHeaders, getApplicationDefault, getApplicationDefault, getQuotaProjectId
-
Methods inherited from class com.google.auth.oauth2.OAuth2Credentials
addChangeListener, getAccessToken, getAuthenticationType, getFromServiceLoader, getRequestMetadata, getRequestMetadata, getRequestMetadataInternal, hasRequestMetadata, hasRequestMetadataOnly, newInstance, refresh, refreshIfExpired, removeChangeListener
-
Methods inherited from class com.google.auth.Credentials
blockingGetToCallback, getRequestMetadata
-
-
-
-
Method Detail
-
fromStream
public static ExternalAccountAuthorizedUserCredentials fromStream(InputStream credentialsStream) throws IOException
Returns external account authorized user credentials defined by a JSON file stream.- Parameters:
credentialsStream
- the stream with the credential definition- Returns:
- the credential defined by the credentialsStream
- Throws:
IOException
- if the credential cannot be created from the stream
-
fromStream
public static ExternalAccountAuthorizedUserCredentials fromStream(InputStream credentialsStream, HttpTransportFactory transportFactory) throws IOException
Returns external account authorized user credentials defined by a JSON file stream.- Parameters:
credentialsStream
- the stream with the credential definitiontransportFactory
- the HTTP transport factory used to create the transport to get access tokens- Returns:
- the credential defined by the credentialsStream
- Throws:
IOException
- if the credential cannot be created from the stream
-
refreshAccessToken
public AccessToken refreshAccessToken() throws IOException
Description copied from class:OAuth2Credentials
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.
- Overrides:
refreshAccessToken
in classOAuth2Credentials
- Returns:
- never
- Throws:
IOException
-
newBuilder
public static ExternalAccountAuthorizedUserCredentials.Builder newBuilder()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classOAuth2Credentials
-
toString
public String toString()
- Overrides:
toString
in classOAuth2Credentials
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classOAuth2Credentials
-
toBuilder
public ExternalAccountAuthorizedUserCredentials.Builder toBuilder()
- Overrides:
toBuilder
in classGoogleCredentials
-
-