ExpressMiddleware
ExpressMiddleware{#ExpressMiddleware}
ServiceAuthorizationMiddleware{#ServiceAuthorizationMiddleware}
ServiceAuthorizationMiddleware
new ServiceAuthorizationMiddleware(options)
Param | Type | Description |
---|---|---|
options |
| Required - |
options.serviceTokenSignSecret |
| Required - Secret to validate token signature against |
authorize(authParams)
Extract and authorize token using the provided auth params
Param | Type | Description |
---|---|---|
authParams |
| Required - Authorization parameters to pass to |
errorHandler([err], req, res, next)
Error handler for errors thrown by ServiceAuthorizationMiddleware
Will handle telling IMSG to redirect unauthorized requests, but will pass on any other errors to next()
Param | Type | Description |
---|---|---|
err |
| Express err |
req |
| Required - Express req |
res |
| Required - Express res |
next |
| Required - Express next |
The type definition of the full auhtorization object with all parameters.
Passed to the authorize function.
Properties
Name | Type | Description |
---|---|---|
onPreAuth |
| Function to run before authorize is called |
org |
| Required - Organiztion to authorize against |
accessRules |
| Optional access rules to authorize against |
suppressLoginTrigger |
| If true, do not redirect failed authorization to login |
The type definition of the access rule.
Passed to the authorize function within the object as a list of access rules.
All properties are optional, but at least one must exist
Properties
Name | Type | Description |
---|---|---|
unit |
| Unit that should match token |
permission |
| Permission that should match token |
sub |
| Subject that should match token |
Type defintion of the authorization mode.
SERVICE_ADMIN_ENDPOINT - Authorization validates if you are a service admin and have a valid token. Either accessed or thrown out.
OPEN_ENDPOINT - Authorization validates if you have a valid token and lets you through to the open endpoint. Either accessed or thrown out.
Either SERVICE_ADMIN_ENDPOINT or OPEN_ENDPOINT
Last updated