/user/cookie

Exports the [user] cookie method for the /api/user/cookie route.

Requires

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.

Parameters:
NameTypeDescription
reqreq

HTTP request.

resres

HTTP response.

Properties
NameTypeAttributesDescription
req.cookiesObject<optional>

The request cookies object.

req.params.destroyboolean<optional>

URL parameter flag whether the cookie should be destroyed.

req.params.createboolean<optional>

URL parameter flag whether a new cookie should be created.

(inner) list(req, res)

/api/user/list returns a list of all ACL records.

Parameters:
NameTypeDescription
reqObject

HTTP request.

resObject

HTTP response.

req.params.userObject

Requesting user.

Properties
NameTypeDescription
adminboolean

Requesting user is admin.

/user/list

Exports the [user] list method for the /api/user/list route.

Requires

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.

Parameters:
NameTypeDescription
reqreq

HTTP request.

resres

HTTP response.

Properties
NameTypeAttributesDescription
req.cookiesObject<optional>

The request cookies object.

req.params.destroyboolean<optional>

URL parameter flag whether the cookie should be destroyed.

req.params.createboolean<optional>

URL parameter flag whether a new cookie should be created.

(inner) list(req, res)

/api/user/list returns a list of all ACL records.

Parameters:
NameTypeDescription
reqObject

HTTP request.

resObject

HTTP response.

req.params.userObject

Requesting user.

Properties
NameTypeDescription
adminboolean

Requesting user is admin.