Function: createAuthorizer()
createAuthorizer<
Principal,Check>(args):object
Defined in: authorizer.ts:88
An authorizer over labeled policy sets that must each allow a check.
getSets is read per check, so a revoked policy takes effect on the next
one; refusedBy names the first group that refused a check and its denial.
Type Parameters
| Type Parameter | Default type |
|---|---|
Principal | - |
Check extends AuthorizationCheck | AuthorizationCheck |
Parameters
| Parameter | Type | Description |
|---|---|---|
args | { defaultResource?: (check) => string | undefined; evaluator: { chainMatches: (check) => boolean; decideOnChain: (check) => PolicyDecision; ownerRoot: (owner) => string | null; withinReach: (check) => boolean; }; getSets: (check) => Promise<LabeledPolicySets<Principal>>; loadLinks?: (link) => Promise<ResourceLink[]>; } | - |
args.defaultResource? | (check) => string | undefined | The name a check naming no resource is decided on; refused when omitted. |
args.evaluator | { chainMatches: (check) => boolean; decideOnChain: (check) => PolicyDecision; ownerRoot: (owner) => string | null; withinReach: (check) => boolean; } | - |
args.evaluator.chainMatches | (check) => boolean | True when pattern reaches the resource for action. |
args.evaluator.decideOnChain | (check) => PolicyDecision | Every tagged node's evaluation must allow; the first refusal decides. A path alias names a place, not a type, so a chain named by one alone states its type or is refused. |
args.evaluator.ownerRoot | (owner) => string | null | The name an owner's reach is rooted at; null for top, which reaches everything. |
args.evaluator.withinReach | (check) => boolean | True when the resource sits within the owner's reach for action. |
args.getSets | (check) => Promise<LabeledPolicySets<Principal>> | - |
args.loadLinks? | (link) => Promise<ResourceLink[]> | The live links of a name; none when omitted. |
Returns
isAllowed
isAllowed: (
check) =>Promise<boolean>
Parameters
| Parameter | Type |
|---|---|
check | Check |
Returns
Promise<boolean>
refusedBy
refusedBy: (
query) =>Refusal<Principal> |undefined
The refusal recorded for action on resource, else for action alone.
Parameters
| Parameter | Type |
|---|---|
query | { action: string; resource: string | null; } |
query.action | string |
query.resource | string | null |
Returns
Refusal<Principal> | undefined