2.0.6 • Published 1 year ago

pleggit-auth-provider-client v2.0.6

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

This is a client that implements the Pleggit AuthProvider check, which means that, when given an idToken it will provide a simple way to verify that token by connecting to the Pleggit auth services and verifying it.

The Pleggit Auth Provider client is meant to be used when using toto-api-controller. Check toto-api-controller version 8.0.0+ This will only work from version 8 on.

Usage

Version 1.0.0

PleggitAuth now does not use nop-ms-auth to verify the token and *trusts the content of the JWT**. As a result, the creation of the PleggtAuth now requires more parameters in the constructors.

You now need to pass two parameters to the constructor:

  • authAPIEndpoint: still mandatory for backward compatibility
  • jwtSigningKey: the key used to sign JWT tokens that can be used to verify the authenticity of the token

So now, to use PleggitAuth as a CustomAuthVerifier, implement the method like this:

getCustomAuthVerifier() {
    return new PleggitAuth({ authAPIEndpoint: process.env.AUTH_MS_ENDPOINT, jwtSigningKey: this.jwtSigningKey });
}

Where jwtSigningKey needs to be loaded from application secrets.

Version 0.1.x and 0.2.0

The toto-api-controller supports passing a config object in the following way.

let api = new Controller(apiName, config.config);

The config object is an instance of a class that looks like this:

class Config {

    load() { ... }

    getCustomAuthVerifier() { ... }
}

Version 8.0.0 of toto-api-controller now supports the Config class to provide a getCustomAuthVerifier() method that will return an instance of a custom auth provider.

To use the Pleggit Auth Provider client, just return an instance of it, as follows:

getCustomAuthVerifier() {
    return new PleggitAuth({ authAPIEndpoint: process.env.AUTH_MS_ENDPOINT });
}

The Pleggit Auth Provider requires an authAPIEndpoint. That is the full endpoint (including https://) of the pleggit service that can verify id tokens.

2.0.3

1 year ago

2.0.2

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.6

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

0.2.0

1 year ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago