Module: utils/auth

Some helper functions/utilities for authentication.
Author:
License:
  • MIT
Source:

Methods

(inner) issueShortToken(username, role) → {object}

Issue a short valid web token for a given user and role. Make it short testing valid duration.
Parameters:
Name Type Description
username string The textual user name
role string The textual user role
Source:
Returns:
JWT token
Type
object

(inner) issueToken(username, role) → {object}

Issue a valid web token for a given user and role. Make it default valid duration.
Parameters:
Name Type Description
username string The textual user name
role string The textual user role
Source:
Returns:
JWT token
Type
object

(async, inner) verifyToken(req, _scopes, schema) → {boolean}

Verify a given token from bearer http header request.
Parameters:
Name Type Description
req object The complete web request
_scopes string Not used here
schema object Secruity schema used for this API method
Source:
Returns:
true if valid token found in request
Type
boolean