Module providing one time authentication
- Description:
Module providing one time authentication
- Source:
Members
(inner) ENDPOINT_PARAM_KEY
- Description:
A literal query string key and value an endpointquery entry may require.
- Source:
A literal query string key and value an endpointquery entry may require.
Methods
(static) check_if_expired(options)
- Description:
Checks if token is not expired yet
- Source:
Parameters:
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | options for the task Properties
|
(static) clean(options)
- Description:
Clean all expired tokens
- Source:
Parameters:
| Name | Type | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | options for the task Properties
|
(static) extend_token(options)
- Description:
extent token life spas
- Source:
Parameters:
| Name | Type | Description | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | options for the task Properties
|
(static) getToken() → {string}
- Description:
Generates auhtentication ID
- Source:
Returns:
id to be used when saving the task
- Type
- string
(static) read(options)
- Description:
Get whole token information from database
- Source:
Parameters:
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | options for the task Properties
|
(static) revokeMemberTokens(options) → {Promise}
- Description:
Revoke the tokens a member owns. Used when a member signs out (purpose LoggedInAuth only) and when their password changes (every token, of any purpose). The owner is matched as a string, because save() stores it as one.
- Source:
Parameters:
| Name | Type | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | options for the task Properties
|
Returns:
resolves once the tokens are removed
- Type
- Promise
(static) save(options)
- Description:
Store token for later authentication
- Source:
Parameters:
| Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | options for the task Properties
|
(static) verify(options)
- Description:
Verify token and expire it
- Source:
Parameters:
| Name | Type | Description | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | options for the task Properties
|
(static) verify_return(options)
- Description:
Similar to authorizer.verify. Only difference - return token owner if valid.
- Source:
Parameters:
| Name | Type | Description | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | options for the task Properties
|
(inner) isLiteralEndpointPath(path) → {boolean}
- Description:
Whether a value is a literal API path a new token may be restricted to: a leading slash and at least two non-empty segments of letters, digits, "_" and "-". Nothing else, so no regex syntax, no wildcard and no path that covers a whole tree ("/", "/o").
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
path |
string | requested endpoint |
Returns:
true if it is a literal API path
- Type
- boolean
(inner) parseEndpointRestriction(endpointParam, endpointQueryParam) → {Object}
- Description:
Parse the endpoint restriction a request asks a new token to carry.
Stored endpoints are regexes matched from the start of the request path, so a value such as "", "/o" or ".*" would cover every path or a whole tree. A new token therefore names concrete paths only, and each is stored anchored at both ends, so "/o/actions" matches /o/actions and nothing else. An endpointquery entry is validated the same way, and the query string values it requires are matched exactly. Tokens stored before keep their own matching.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
endpointParam |
string | undefined | comma separated paths (the endpoint parameter) |
endpointQueryParam |
string | undefined | JSON array of {endpoint, params} (the endpointquery parameter) |
Returns:
the endpoint field to store ("" for none), or an error
- Type
- Object
(inner) verify_token(options, return_owner, return_data)
- Description:
Token validation function called from verify and verify return
- Source:
Parameters:
| Name | Type | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | options for the task Properties
|
|||||||||||||||
return_owner |
boolean | states if in callback owner shold be returned. If return_owner==false, returns true or false. |
|||||||||||||||
return_data |
boolean | states if in callback all token data should be returned. |