@cumulus/launchpad-auth
v22.3.2
Published
Utilities for authentication with Launchpad
Readme
@cumulus/launchpad-auth
Utilities for authentication by Cumulus using Launchpad.
Usage
npm install @cumulus/launchpad-authAPI
Modules
Classes
launchpad-auth
Utility functions for generating, refreshing, and validating Launchpad tokens
getLaunchpadToken(params, skipLockWait) ⇒ ⏏
Get a Launchpad token. There may be a lock file if the token is being recreated by a process due to a launchpad 401 auth error, so this function will check if there is one and wait until it's removed by the process creating the new token, and then will get the newly made valid token.
Kind: Exported function Returns: - the Launchpad token
| Param | Description | | --- | --- | | params | the configuration parameters for creating LaunchpadToken object | | params.api | the Launchpad token service api endpoint | | params.passphrase | the passphrase of the Launchpad PKI certificate | | params.certificate | the name of the Launchpad PKI pfx certificate | | skipLockWait | whether or not to skip waiting for the lock to release |
validateLaunchpadToken(params, token, [userGroup]) ⇒ ⏏
Validate a Launchpad token
Kind: Exported function Returns: The validate result object with: status - 'success' or 'failed'; message - reason for failure; session_maxtimeout - number (seconds); session_starttime - number (milliseconds); owner_auid - string
| Param | Description | | --- | --- | | params | the configuration parameters for creating LaunchpadToken object | | params.api | the Launchpad token service api endpoint | | params.passphrase | the passphrase of the Launchpad PKI certificate | | params.certificate | the name of the Launchpad PKI pfx certificate | | token | the token to be validated | | [userGroup] | the cumulus user group that a valid user should belong to |
LaunchpadToken
A class for sending requests to Launchpad token service endpoints
Kind: global class
- LaunchpadToken
- new LaunchpadToken(params)
- .requestToken() ⇒ Promise.<Object>
- .validateToken(token) ⇒ Promise.<Object>
new LaunchpadToken(params)
| Param | Type | Description | | --- | --- | --- | | params | Object | | | params.api | string | the Launchpad token service api endpoint | | params.passphrase | string | the passphrase of the Launchpad PKI certificate | | params.certificate | string | the name of the Launchpad PKI pfx certificate |
Example
const LaunchpadToken = require('@cumulus/launchpad-auth/LaunchpadToken');
const launchpadToken = new LaunchpadToken({
api: 'launchpad-token-api-endpoint',
passphrase: 'my-pki-passphrase',
certificate: 'my-pki-certificate.pfx'
});launchpadToken.requestToken() ⇒ Promise.<Object>
Get a token from Launchpad
Kind: instance method of LaunchpadToken Returns: Promise.<Object> - - the Launchpad gettoken response object
launchpadToken.validateToken(token) ⇒ Promise.<Object>
Validate a Launchpad token
Kind: instance method of LaunchpadToken Returns: Promise.<Object> - - the Launchpad validate token response object
| Param | Type | Description | | --- | --- | --- | | token | string | the Launchpad token for validation |
About Cumulus
Cumulus is a cloud-based data ingest, archive, distribution and management prototype for NASA's future Earth science data streams.
Contributing
To make a contribution, please see our contributing guidelines.
Generated automatically using npm run build-docs
