:wagoe/permission-registry: the registry core.authorization builds,
behind IPermissionRegistry, the scope check of a route (ADR-041 §4) and
the authorization interceptor that runs both (§5).
Read it at the REPL with
(ports/permissions (get (wagoe.platform.shell.system.wiring/system) :wagoe/permission-registry))
`:wagoe/permission-registry`: the registry `core.authorization` builds,
behind `IPermissionRegistry`, the scope check of a route (ADR-041 §4) and
the authorization interceptor that runs both (§5).
Read it at the REPL with
(ports/permissions (get (wagoe.platform.shell.system.wiring/system)
:wagoe/permission-registry))(assert-route-permissions! registry routes)Throw :configuration-error when a route's :permission is not in
registry, its :scope is not one core.scope reads or sits on a route
that checks none, or its :authorization is neither :signed-in nor
:self. routes are a
router's flattened [path data] pairs.
Throw :configuration-error when a route's `:permission` is not in `registry`, its `:scope` is not one `core.scope` reads or sits on a route that checks none, or its `:authorization` is neither `:signed-in` nor `:self`. `routes` are a router's flattened [path data] pairs.
(authorization-middleware registry rights-source {:keys [mode]})Reitit middleware deciding every endpoint by core/route-rule, then its
scope (authorize-scope); a platform admin passes everything. Mounted
after the sign-in guard, so it sees only signed-in callers, and not at all
on a rule that admits every one of them. rights-source is an IRights,
read once per request and kept on it as :wagoe/rights for
request-rights, under :report too. mode: :report logs what
:enforce refuses and lets it through, as it does a check that throws;
:off mounts nothing.
Reitit middleware deciding every endpoint by `core/route-rule`, then its scope (`authorize-scope`); a platform admin passes everything. Mounted after the sign-in guard, so it sees only signed-in callers, and not at all on a rule that admits every one of them. `rights-source` is an `IRights`, read once per request and kept on it as `:wagoe/rights` for `request-rights`, under `:report` too. `mode`: `:report` logs what `:enforce` refuses and lets it through, as it does a check that throws; `:off` mounts nothing.
(authorize-scope request scopes route-scope)The scope check of a route whose data says route-scope, for a caller
holding the route's permission in scopes (core.scope/scopes-for).
{:request r}, the scopes on it as :wagoe/scopes for
core.scope/scope-filter, or {:response r :error e}: 403, or 404 for a
parameter outside their scope.
The scope check of a route whose data says `route-scope`, for a caller
holding the route's permission in `scopes` (`core.scope/scopes-for`).
`{:request r}`, the scopes on it as `:wagoe/scopes` for
`core.scope/scope-filter`, or `{:response r :error e}`: 403, or 404 for a
parameter outside their scope.(create-registry declarations)The registry from declarations, {module-key declaration}. Throws
:configuration-error, so a bad declaration fails boot.
The registry from `declarations`, {module-key declaration}. Throws
:configuration-error, so a bad declaration fails boot.(explain registry rights-source user permission record)Why user may or may not use permission on record ({scope-key value},
nil for anywhere), as core.scope/explain gives it: the rights read from
rights-source and resolved as the interceptor does. Each right keeps the
keys IRights gave it, and its stored scope as :stored-scope.
Why `user` may or may not use `permission` on `record` ({scope-key value},
nil for anywhere), as `core.scope/explain` gives it: the rights read from
`rights-source` and resolved as the interceptor does. Each right keeps the
keys `IRights` gave it, and its stored scope as `:stored-scope`.(request-rights registry rights-source request pred)The rights of the caller of request whose permission pred admits,
resolved as rights-for does. Taken from :wagoe/rights when the
authorization middleware read them, else read now: one read per request
on a permission route, one per call elsewhere (:self, :signed-in).
None for a platform admin, who holds every permission, or without a user.
The rights of the caller of `request` whose permission `pred` admits, resolved as `rights-for` does. Taken from `:wagoe/rights` when the authorization middleware read them, else read now: one read per request on a permission route, one per call elsewhere (`:self`, `:signed-in`). None for a platform admin, who holds every permission, or without a user.
(resolve-rights registry user rights)rights as the user module hands them over for user
([{:permission :scope}], see core.scope), each scope as {key #{value}}:
sources resolved, then expanded. Per request, so a move or a descendant
added later counts. A right whose scope resolves to nothing for a key is
dropped: it gives no rights, not rights everywhere.
`rights` as the user module hands them over for `user`
([{:permission :scope}], see `core.scope`), each scope as {key #{value}}:
sources resolved, then expanded. Per request, so a move or a descendant
added later counts. A right whose scope resolves to nothing for a key is
dropped: it gives no rights, not rights everywhere.(rights-for registry rights-source user pred)user's rights whose permission pred admits, read once and resolved.
Only those are resolved: a resolver may read. None without a source.
`user`'s rights whose permission `pred` admits, read once and resolved. Only those are resolved: a resolver may read. None without a source.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |