AbstractAuthModule

auth. AbstractAuthModule

Abstract module to be overridden by specific auth implementations

Constructor

new AbstractAuthModule()

Source:

Extends

  • AbstractModule

Members

auth :AuthModule

Source:
Cached reference to the auth module
Type:
  • AuthModule

registerHook :Hook

Source:
Hook which is invoked when a new user is registered in the system
Type:
  • Hook

router :Router

Source:
The router instance
Type:
  • Router

routes :Array.<Route>

Source:
Custom endpoints for the auth type
Type:
  • Array.<Route>

type :String

Source:
Identifier for the auth type
Type:
  • String

users :UsersModule

Source:
Cached reference to the auth module
Type:
  • UsersModule

userSchema :String

Source:
Name of the schema to use when validating a user using this auth type
Type:
  • String

Methods

(async) authenticate(user, req, res) → {Promise}

Source:
Checks whether a user is allowed access to the APIs and performs any related auth type specific actions
Parameters:
Name Type Description
user Object The user record
req external:ExpressRequest
res external:ExpressResponse
Returns:
Resolves on success
Type
Promise

(async) authenticateHandler(req, res, next)

Source:
Handles authentication requests
Parameters:
Name Type Description
req external:ExpressRequest
res external:ExpressResponse
next function

(async) disavowUser(query) → {Promise}

Source:
A convenience function for accessing Authentication#disavowUser
Parameters:
Name Type Description
query object Search query
Returns:
Type
Promise

(async) enableHandler(req, res, next)

Source:
Handles user enable/disable requests
Parameters:
Name Type Description
req external:ExpressRequest
res external:ExpressResponse
next function

(async) init() → {Promise}

Source:
Initialises the module
Returns:
Type
Promise

(async) register(data) → {Promise}

Source:
Registers a new user
Parameters:
Name Type Description
data Object Data to be used for doc creation
Returns:
Resolves with the new user's data
Type
Promise

(async) registerHandler(req, res, next)

Source:
Handles user registration requests
Parameters:
Name Type Description
req external:ExpressRequest
res external:ExpressResponse
next function

secureRoute(route, method, scopes)

Source:
Locks a route to only users with the passed permissions scopes
Parameters:
Name Type Description
route String The route
method String The HTTP method
scopes Array.<String> Permissions scopes

(async) setUserEnabled(user, isEnabled) → {Promise}

Source:
Sets the appropriate attributes to enable/disable user
Parameters:
Name Type Description
user Object User DB document
isEnabled boolean Whether the user should be enabled
Returns:
Type
Promise

(async) setValues() → {Promise}

Source:
Sets initial module values (set during initialisation), can be called by subclasses
Returns:
Type
Promise

unsecureRoute(route, method)

Source:
Removes auth checks from a single route Auth#unsecureRoute
Parameters:
Name Type Description
route String The route
method String The HTTP method