Extends
- AbstractModule
Members
auth :AuthModule
- Description:
- Cached reference to the auth module
 
- Source:
    Cached reference to the auth module
    Type:
- AuthModule
registerHook :Hook
- Description:
- Hook which is invoked when a new user is registered in the system
 
- Source:
    Hook which is invoked when a new user is registered in the system
    Type:
- Hook
router :Router
- Description:
- The router instance
 
- Source:
    The router instance
    Type:
- Router
routes :Array.<Route>
- Description:
- Custom endpoints for the auth type
 
- Source:
    Custom endpoints for the auth type
    Type:
- Array.<Route>
type :String
- Description:
- Identifier for the auth type
 
- Source:
    Identifier for the auth type
    Type:
- String
userSchema :String
- Description:
- Name of the schema to use when validating a user using this auth type
 
- Source:
    Name of the schema to use when validating a user using this auth type
    Type:
- String
users :UsersModule
- Description:
- Cached reference to the auth module
 
- Source:
    Cached reference to the auth module
    Type:
- UsersModule
Methods
(async) authenticate(user, req, res) → {Promise}
- Description:
- Checks whether a user is allowed access to the APIs and performs any related auth type specific actions
 
- Source:
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)
- Description:
- Handles authentication requests
 
- Source:
Parameters:
| Name | Type | Description | 
|---|---|---|
| req | external:ExpressRequest | |
| res | external:ExpressResponse | |
| next | function | 
(async) disavowUser(query) → {Promise}
- Description:
- A convenience function for accessing Authentication#disavowUser
 
- Source:
Parameters:
| Name | Type | Description | 
|---|---|---|
| query | object | Search query | 
Returns:
- Type
- Promise
(async) enableHandler(req, res, next)
- Description:
- Handles user enable/disable requests
 
- Source:
Parameters:
| Name | Type | Description | 
|---|---|---|
| req | external:ExpressRequest | |
| res | external:ExpressResponse | |
| next | function | 
(async) init() → {Promise}
- Description:
- Initialises the module
 
- Source:
Returns:
- Type
- Promise
(async) register(data) → {Promise}
- Description:
- Registers a new user
 
- Source:
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)
- Description:
- Handles user registration requests
 
- Source:
Parameters:
| Name | Type | Description | 
|---|---|---|
| req | external:ExpressRequest | |
| res | external:ExpressResponse | |
| next | function | 
secureRoute(route, method, scopes)
- Description:
- Locks a route to only users with the passed permissions scopes
 
- Source:
Parameters:
| Name | Type | Description | 
|---|---|---|
| route | String | The route | 
| method | String | The HTTP method | 
| scopes | Array.<String> | Permissions scopes | 
(async) setUserEnabled(user, isEnabled) → {Promise}
- Description:
- Sets the appropriate attributes to enable/disable user
 
- Source:
Parameters:
| Name | Type | Description | 
|---|---|---|
| user | Object | User DB document | 
| isEnabled | boolean | Whether the user should be enabled | 
Returns:
- Type
- Promise
(async) setValues() → {Promise}
- Description:
- Sets initial module values (set during initialisation), can be called by subclasses
 
- Source:
Returns:
- Type
- Promise
unsecureRoute(route, method)
- Description:
- Removes auth checks from a single route Auth#unsecureRoute
 
- Source:
Parameters:
| Name | Type | Description | 
|---|---|---|
| route | String | The route | 
| method | String | The HTTP method |