TokenUtils
Last updated
Last updated
Module with helper functions for the Tokens.
Object
Extracts and decodes a service token from a raw request
Returns: Object
- serviceToken - The service token
Param | Type |
---|---|
String
| null
Extracts IMID token from a raw request if present
Returns: String
| null
- imidToken - The IMID token if present
Param | Type |
---|---|
String
Get the subject from the service token
Returns: String
- organization - The subject identifier set on the service token
Param | Type |
---|---|
String
Get the subject's organization
Returns: String
- organization - The organization the subject belongs to
Array.<String>
Get the subject's mapped units
Returns: Array.<String>
- units - An array of all units the subject belongs to
null
| String
Get the subject's selected unit
Returns: null
| String
- unit - The subject's selected unit, null if no unit selected
Array.<String>
Get the subject's organization permissions
Organization permissions are located under permissions.org
Returns: Array.<String>
- } permissions - The subject's org permissions
Array.<String>
Get the subject's permissions for the specified unit
Unit permissions are located under permissions.units[unit]
Returns: Array.<String>
- permissions - The subject's permissions for the specified unit
Boolean
Checks if a token belogs to an admin for the service
Returns: Boolean
- isServiceAdmin - True if the token belongs to an admin for the service
Object
Get the subject's userinfo
Returns: Object
- userinfo - The userinfo object set on the subject
Param | Type |
---|---|
Param | Type |
---|---|
Param | Type |
---|---|
Param | Type |
---|---|
Param | Type | Description |
---|---|---|
Param | Type |
---|---|
Param | Type |
---|---|
request
http.IncomingMessage
request
http.IncomingMessage
request
http.IncomingMessage
request
http.IncomingMessage
request
http.IncomingMessage
request
http.IncomingMessage
request
http.IncomingMessage
request
http.IncomingMessage
Required -
unit
String
Required - The unit permissions should be checked in
request
http.IncomingMessage
request
http.IncomingMessage