public class PluggableAuthCredentials extends ExternalAccountCredentials
To use these credentials, the GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES environment variable must be set to '1'. This is for security reasons.
Both OIDC and SAML are supported. The executable must adhere to a specific response format defined below.
The executable must print out the 3rd party token to STDOUT in JSON format. When an output_file is specified in the credential configuration, the executable must also handle writing the JSON response to this file.
OIDC response sample: { "version": 1, "success": true, "token_type": "urn:ietf:params:oauth:token-type:id_token", "id_token": "HEADER.PAYLOAD.SIGNATURE", "expiration_time": 1620433341 } SAML2 response sample: { "version": 1, "success": true, "token_type": "urn:ietf:params:oauth:token-type:saml2", "saml_response": "...", "expiration_time": 1620433341 } Error response sample: { "version": 1, "success": false, "code": "401", "message": "Error message." }
The `expiration_time` field in the JSON response is only required for successful responses when an output file was specified in the credential configuration.
The auth libraries will populate certain environment variables that will be accessible by the executable, such as: GOOGLE_EXTERNAL_ACCOUNT_AUDIENCE, GOOGLE_EXTERNAL_ACCOUNT_TOKEN_TYPE, GOOGLE_EXTERNAL_ACCOUNT_INTERACTIVE, GOOGLE_EXTERNAL_ACCOUNT_IMPERSONATED_EMAIL, and GOOGLE_EXTERNAL_ACCOUNT_OUTPUT_FILE.
Please see this repositories README for a complete executable request/response specification.
Modifier and Type | Class and Description |
---|---|
static class |
PluggableAuthCredentials.Builder |
OAuth2Credentials.CredentialsChangedListener
impersonatedCredentials, transportFactory
quotaProjectId
Modifier and Type | Method and Description |
---|---|
PluggableAuthCredentials |
createScoped(Collection<String> newScopes)
Clones the PluggableAuthCredentials with the specified scopes.
|
static PluggableAuthCredentials.Builder |
newBuilder() |
static PluggableAuthCredentials.Builder |
newBuilder(PluggableAuthCredentials pluggableAuthCredentials) |
AccessToken |
refreshAccessToken()
Method to refresh the access token according to the specific type of credentials.
|
String |
retrieveSubjectToken()
Returns the 3rd party subject token by calling the executable specified in the credential
source.
|
exchangeExternalCredentialForAccessToken, fromStream, fromStream, getAudience, getClientId, getClientSecret, getCredentialSource, getRequestMetadata, getRequestMetadata, getScopes, getServiceAccountEmail, getServiceAccountImpersonationOptions, getServiceAccountImpersonationUrl, getSubjectTokenType, getTokenInfoUrl, getTokenUrl, getWorkforcePoolUserProject, isWorkforcePoolConfiguration
create, createDelegated, createScoped, createScoped, createScopedRequired, createWithCustomRetryStrategy, createWithQuotaProject, getAdditionalHeaders, getApplicationDefault, getApplicationDefault, getQuotaProjectId, toBuilder
addChangeListener, equals, getAccessToken, getAuthenticationType, getFromServiceLoader, getRequestMetadataInternal, hashCode, hasRequestMetadata, hasRequestMetadataOnly, newInstance, refresh, refreshIfExpired, removeChangeListener, toString
blockingGetToCallback, getRequestMetadata
public AccessToken refreshAccessToken() throws IOException
OAuth2Credentials
Throws IllegalStateException if not overridden since direct use of OAuth2Credentials is only for temporary or non-refreshing access tokens.
refreshAccessToken
in class OAuth2Credentials
IOException
public String retrieveSubjectToken() throws IOException
retrieveSubjectToken
in class ExternalAccountCredentials
IOException
- if an error occurs with the executable execution.public PluggableAuthCredentials createScoped(Collection<String> newScopes)
createScoped
in class GoogleCredentials
newScopes
- Collection of scopes to request.public static PluggableAuthCredentials.Builder newBuilder()
public static PluggableAuthCredentials.Builder newBuilder(PluggableAuthCredentials pluggableAuthCredentials)
Copyright © 2023 Google. All rights reserved.