/user/cookie
Exports the [user] cookie method for the /api/user/cookie route.
- Source
- Source
Requires
- module:/user/acl
- module:/user/login
- module:jsonwebtoken
Methods
(async, inner) cookie(req, res)
The cookie method attempts to find a request cookie matching the process.env.TITLE
variable.
The cookie will be destroyed [set to NULL] with detroy request parameter truthy.
The cookie method will use the jsonwebtoken library to verify the existing cookie.
If veriffied successfully a new token with updated user credentials will be signed.
The process.env.SECRET
variable will be used to sign the token.
The process.env.COOKIE_TTL
will be set as time to life for the cookie set on the response header.
The token user will be sent back to the client.
Name | Type | Attributes | Description |
---|---|---|---|
req.cookies | Object | <optional> | The request cookies object. |
req.params.destroy | boolean | <optional> | URL parameter flag whether the cookie should be destroyed. |
req.params.create | boolean | <optional> | URL parameter flag whether a new cookie should be created. |
- Source
(inner) list(req, res)
/api/user/list returns a list of all ACL records.
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
req | Object | HTTP request. | ||||||
res | Object | HTTP response. | ||||||
req.params.user | Object | Requesting user. Properties
|
- Source