TokenUtils
TokenUtils{#TokenUtils}
Module with helper functions for the Tokens.
extractServiceTokenFromRequest(request) {#extractServiceTokenFromRequest}⇒ Object
Object
Extracts and decodes a service token from a raw request
Returns: Object
- serviceToken - The service token
request
http.IncomingMessage
extractImidTokenFromRequest(request) {#extractImidTokenFromRequest}⇒ String
| null
String
| null
Extracts IMID token from a raw request if present
Returns: String
| null
- imidToken - The IMID token if present
request
http.IncomingMessage
getSubject(request) {#getSubject}⇒ String
String
Get the subject from the service token
Returns: String
- organization - The subject identifier set on the service token
request
http.IncomingMessage
getOrganization(request) {#getOrganization}⇒ String
String
Get the subject's organization
Returns: String
- organization - The organization the subject belongs to
request
http.IncomingMessage
getUnits(request) {#getUnits}⇒ Array.<String>
Array.<String>
Get the subject's mapped units
Returns: Array.<String>
- units - An array of all units the subject belongs to
request
http.IncomingMessage
getSelectedUnit(request) {#getSelectedUnit}⇒ null
| String
null
| String
Get the subject's selected unit
Returns: null
| String
- unit - The subject's selected unit, null if no unit selected
request
http.IncomingMessage
getOrgPermissions(request) {#getOrgPermissions}⇒ Array.<String>
Array.<String>
Get the subject's organization permissions
Organization permissions are located under permissions.org
Returns: Array.<String>
- } permissions - The subject's org permissions
request
http.IncomingMessage
getUnitPermissions(request, unit) {#getUnitPermissions}⇒ Array.<String>
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
request
http.IncomingMessage
Required -
unit
String
Required - The unit permissions should be checked in
isServiceAdmin(request) {#isServiceAdmin}⇒ Boolean
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
request
http.IncomingMessage
getUserinfo(request) {#getUserinfo}⇒ Object
Object
Get the subject's userinfo
Returns: Object
- userinfo - The userinfo object set on the subject
request
http.IncomingMessage
Last updated