npm.io
22.4.1 • Published 2h ago

@cumulus/launchpad-auth

Licence
Apache-2.0
Version
22.4.1
Deps
6
Size
663 kB
Vulns
0
Weekly
0
Stars
304

@cumulus/launchpad-auth

Utilities for authentication by Cumulus using Launchpad.

Usage

  npm install @cumulus/launchpad-auth

API

Modules
launchpad-auth

Utility functions for generating, refreshing, and validating Launchpad tokens

Classes
LaunchpadToken

A class for sending requests to Launchpad token service endpoints

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

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.

Cumulus Documentation

Contributing

To make a contribution, please see our contributing guidelines.


Generated automatically using npm run build-docs

Keywords