Skip to content

Latest commit

 

History

History
34 lines (23 loc) · 1.58 KB

File metadata and controls

34 lines (23 loc) · 1.58 KB

Authentication Service

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.