tokeninc-auth-kit

1.0.12 • Public • Published

tokeninc-auth-kit

This framework simlifies integration with the authorization framework, which is combined with the session config. After cloning the repository, please run the following command on the command line, in order to install the required node packages:

npm install

Integration

Create the configuration object with following fields.

const TOKEN_AUTH_CONFIG = {
  "realm": <auth_server_realm_of_the_application>,
  "auth-server":  <auth_server_url>, 
  "client-id": <application client_id>,
  "client-secret": <application client_secret>,
  "session-name": <session_name>,
  "session-secret": <session_secret>
}

Afterwards, all is necessary to pass Express application context and the config above.

const TokenAuthController = require("token-auth-framework")

...

const tokenAuth = new TokenAuthController()
tokenAuth.initialize(app, TOKEN_AUTH_CONFIG)

Behaviour

If the user is not authorized, will redirected to the authorization server. Logout path is "/logout" To fetch the role info of the user use: "req.user.role".

Readme

Keywords

Package Sidebar

Install

npm i tokeninc-auth-kit

Weekly Downloads

17

Version

1.0.12

License

ISC

Unpacked Size

5.92 kB

Total Files

6

Last publish

Collaborators

  • tokeninc_developer