Constructor
new PluggableAuthClient(options)
Instantiates a PluggableAuthClient instance using the provided JSON object loaded from an external account credentials file. An error is thrown if the credential is not a valid pluggable auth credential.
Parameters:
Name | Type | Description |
---|---|---|
options |
The external account options object typically loaded from the external account JSON credential file. |
Members
command
The command used to retrieve the third party token.
handler
Executable and output file handler.
outputFile
The path to file to check for cached executable response.
timeoutMillis
The timeout in milliseconds for running executable, set to default if none provided.
Methods
(async) retrieveSubjectToken()
Triggered when an external subject token is needed to be exchanged for a
GCP access token via GCP STS endpoint.
This uses the options.credential_source
object to figure out how
to retrieve the token using the current environment. In this case,
this calls a user provided executable which returns the subject token.
The logic is summarized as:
- Validated that the executable is allowed to run. The GOOGLE_EXTERNAL_ACCOUNT_ALLOW_EXECUTABLES environment must be set to 1 for security reasons.
- If an output file is specified by the user, check the file location for a response. If the file exists and contains a valid response, return the subject token from the file.
- Call the provided executable and return response.
Returns:
Type | Description |
---|---|
A promise that resolves with the external subject token. |