Package com.google.auth.oauth2
Class IdentityPoolCredentials
- 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.IdentityPoolCredentials
-
- All Implemented Interfaces:
QuotaProjectIdProvider
,Serializable
public class IdentityPoolCredentials extends ExternalAccountCredentials
Url-sourced and file-sourced external account credentials.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
IdentityPoolCredentials.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 IdentityPoolCredentials
createScoped(Collection<String> newScopes)
Clones the IdentityPoolCredentials with the specified scopes.static IdentityPoolCredentials.Builder
newBuilder()
static IdentityPoolCredentials.Builder
newBuilder(IdentityPoolCredentials identityPoolCredentials)
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 IdentityPoolCredentials createScoped(Collection<String> newScopes)
Clones the IdentityPoolCredentials with the specified scopes.- Overrides:
createScoped
in classGoogleCredentials
- Parameters:
newScopes
- Collection of scopes to request.- Returns:
- GoogleCredentials with requested scopes.
-
newBuilder
public static IdentityPoolCredentials.Builder newBuilder()
-
newBuilder
public static IdentityPoolCredentials.Builder newBuilder(IdentityPoolCredentials identityPoolCredentials)
-
-