JavaScript WAC-Allow parser
This npm library parses the WAC-Allow
HTTP header,
which indicates the permissions of the user and the public
on the resource.
The WAC-Allow HTTP header
The WAC-Allow
header,
as used by the Solid server,
lists the permissions of the currently logged in user on the given resource,
as well as the permissions of anonymous users.
Example:
WAC-Allow: user="read write", public="read"
Installation
$ npm install wac-allow
Usage
parse
method
This library exports a convenience method parse
,
which returns a key/value object of users
and the set of permissions they have.
The user
key represents the current user;
the public
key represents everyone that is not logged in.
Both keys are always present,
regardless of whether they occur in the parsed WAC-Allow
header.
Example:
; // The input can be a string, or a Response or Header object;
WacAllowParser
class
Alternatively, you can use the WacAllowParser
class,
which offers specific methods per type.
Example:
; const parser = ;console; ;