1.0.0 • Published 11 months ago

@aws/workbench-core-authentication v1.0.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
11 months ago

Workbench Core Authentication

main branch coverage

codecov

develop branch coverage

codecov

Description

An authentication service that implements the authorization code grant to handle user authentication. The provided AuthenticationPlugin reference implementation, CognitoAuthenticationPlugin, uses Cognito as the backing IdP.

Usage

Initialization

// Initialize a CognitoAuthenticationPluginOptions object
const cognitoAuthenticationPluginOptions: CognitoAuthenticationPluginOptions = {
  cognitoDomain: '<Cognito Hosted UI Domain>',
  userPoolId: '<Cognito User Pool ID>',
  clientId: '<Cognito User Pool Client ID>',
  clientSecret: '<Cognito User Pool Client Secret>',
  websiteUrl: '<Website URL>'
};

// Create an AuthenticationPlugin instance
const cognitoAuthenticationPlugin = new CognitoAuthenticationPlugin(cognitoAuthenticationPluginOptions);

// Create an AuthenticationService instance
const authenticationService = new AuthenticationService(cognitoAuthenticationPlugin);

Integration with Express

Documentation on integrating AuthenticationService with Express can be found here.

Extending AuthenticationService

AuthenticationService provides one AuthenticationPlugin reference implementation called CognitoAuthenticationPlugin that uses Cognito as the Identity Provider (IdP). Cognito can integrate with any OIDC compatible external IdP, but if another primary IdP is required, a custom AuthenticationPlugin can be created. A user-provided plugin must implement the AuthenticationPlugin interface.