Package com.google.auth.oauth2
Class AwsCredentials
- java.lang.Object
-
- com.google.auth.Credentials
-
- com.google.auth.oauth2.OAuth2Credentials
-
- com.google.auth.oauth2.GoogleCredentials
-
- com.google.auth.oauth2.ExternalAccountCredentials
-
- com.google.auth.oauth2.AwsCredentials
-
- All Implemented Interfaces:
QuotaProjectIdProvider
,Serializable
public class AwsCredentials extends ExternalAccountCredentials
AWS credentials representing a third-party identity for calling Google APIs.By default, attempts to exchange the external credential for a GCP access token.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AwsCredentials.Builder
-
Nested classes/interfaces inherited from class com.google.auth.oauth2.OAuth2Credentials
OAuth2Credentials.CredentialsChangedListener
-
-
Field Summary
-
Fields inherited from class com.google.auth.oauth2.ExternalAccountCredentials
impersonatedCredentials, transportFactory
-
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 GoogleCredentials
createScoped(Collection<String> newScopes)
Clones the AwsCredentials with the specified scopes.static AwsCredentials.Builder
newBuilder()
static AwsCredentials.Builder
newBuilder(AwsCredentials awsCredentials)
AccessToken
refreshAccessToken()
Method to refresh the access token according to the specific type of credentials.String
retrieveSubjectToken()
Retrieves the external subject token to be exchanged for a Google Cloud access token.-
Methods inherited from class com.google.auth.oauth2.ExternalAccountCredentials
exchangeExternalCredentialForAccessToken, fromStream, fromStream, getAudience, getClientId, getClientSecret, getCredentialSource, getRequestMetadata, getRequestMetadata, getScopes, getServiceAccountEmail, getServiceAccountImpersonationOptions, getServiceAccountImpersonationUrl, getSubjectTokenType, getTokenInfoUrl, getTokenUrl, getWorkforcePoolUserProject, isWorkforcePoolConfiguration
-
Methods inherited from class com.google.auth.oauth2.GoogleCredentials
create, createDelegated, createScoped, createScoped, createScopedRequired, createWithCustomRetryStrategy, createWithQuotaProject, getAdditionalHeaders, getApplicationDefault, getApplicationDefault, getQuotaProjectId, toBuilder
-
Methods inherited from class com.google.auth.oauth2.OAuth2Credentials
addChangeListener, equals, getAccessToken, getAuthenticationType, getFromServiceLoader, getRequestMetadataInternal, hashCode, hasRequestMetadata, hasRequestMetadataOnly, newInstance, refresh, refreshIfExpired, removeChangeListener, toString
-
Methods inherited from class com.google.auth.Credentials
blockingGetToCallback, getRequestMetadata
-
-
-
-
Method Detail
-
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
-
retrieveSubjectToken
public String retrieveSubjectToken() throws IOException
Description copied from class:ExternalAccountCredentials
Retrieves the external subject token to be exchanged for a Google Cloud access token.Must be implemented by subclasses as the retrieval method is dependent on the credential source.
- Specified by:
retrieveSubjectToken
in classExternalAccountCredentials
- Returns:
- the external subject token
- Throws:
IOException
- if the subject token cannot be retrieved
-
createScoped
public GoogleCredentials createScoped(Collection<String> newScopes)
Clones the AwsCredentials with the specified scopes.- Overrides:
createScoped
in classGoogleCredentials
- Parameters:
newScopes
- Collection of scopes to request.- Returns:
- GoogleCredentials with requested scopes.
-
newBuilder
public static AwsCredentials.Builder newBuilder()
-
newBuilder
public static AwsCredentials.Builder newBuilder(AwsCredentials awsCredentials)
-
-