1.0.8 • Published 4 years ago

token-auth-framework v1.0.8

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago

token-auth-framework

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".

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago