Members
routes :RouteStore
- Description:
- Reference to all secured routes. Note that any route not explicitly secured will be denied by default.
- Source:
Reference to all secured routes. Note that any route not explicitly secured will be denied by default.
Type:
- RouteStore
Example
{
post: { "/api/test": true }
}
Methods
(async) check(req) → {Promise}
- Description:
- Checks incoming request against stored permissions
- Source:
Parameters:
Name | Type | Description |
---|---|---|
req |
external:ExpressRequest |
Returns:
Resolves if request user passes checks
- Type
- Promise
(async) checkRoutes(app) → {Promise}
- Description:
- Checks for routes which don't have valid permissions set, and logs a warning message (as these routes will not be accessible from the API)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
app |
App | The app instance |
Returns:
- Type
- Promise
getScopesForRoute(method, route) → {Array}
- Description:
- Returns the scopes needed for a specific route
- Source:
Parameters:
Name | Type | Description |
---|---|---|
method |
String | HTTP method |
route |
String | The route to check |
Returns:
the scopes required for route
- Type
- Array
secureRoute(route, method, scopes)
- Description:
- Restricts access to a route/endpoint
- Source:
Parameters:
Name | Type | Description |
---|---|---|
route |
String | The route/endpoint to secure |
method |
String | HTTP method to block |
scopes |
Array | The scopes to restrict |
(async, static) init() → {Promise}
- Description:
- Creates and instanciates the class
- Source:
Returns:
Resolves with the instance
- Type
- Promise