Skip to main content

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 ParameterDefault type
Principal-
Check extends AuthorizationCheckAuthorizationCheck

Parameters​

ParameterTypeDescription
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 | undefinedThe 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) => booleanTrue when pattern reaches the resource for action.
args.evaluator.decideOnChain(check) => PolicyDecisionEvery 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 | nullThe name an owner's reach is rooted at; null for top, which reaches everything.
args.evaluator.withinReach(check) => booleanTrue 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​

ParameterType
checkCheck

Returns​

Promise<boolean>

refusedBy​

refusedBy: (query) => Refusal<Principal> | undefined

The refusal recorded for action on resource, else for action alone.

Parameters​

ParameterType
query{ action: string; resource: string | null; }
query.actionstring
query.resourcestring | null

Returns​

Refusal<Principal> | undefined