import type { IPermissionEvaluator } from '../evaluator'; import type { AuthorizationCheckEvaluatorInput, AuthorizationEvaluatorInput, AuthorizationEvaluatorOptions } from './types'; /** * Build a resource-server (or console) evaluator from the catalog * `GET /authorization` serves, the identity's grants as the introspection * endpoints report them, and the identity itself. Rejects legacy, incomplete * and unsupported input. A grant referencing a definition or a policy the * catalog lacks throws `AuthorizationCatalogStaleError`, the signal to * refetch the catalog: the grants come from a fresh introspection while the * catalog may predate the definition or the junction row. A definition the * server could not project travels with `policies: null` instead of being * left out, so a grant of it is dropped rather than reported stale: the * definition layer cannot be evaluated here, a refetch changes nothing, and * the permission denies until the policy is fixed. * * A tree THIS copy cannot project is the same condition read from the other * side, and it is per tree: a policy type the validator registry lacks (a * type newer than this package, or a custom one the caller did not register) * or a configuration its validator refuses denies the definitions that reference * it, exactly as `policies: null` does, and drops a grant that names it, * exactly as a binding check does. One such tree never takes the evaluator * down for the permissions that do not use it. A malformed catalog still * throws: a duplicate permission namespace is not a data condition. * * Both the identity and the grants are optional. Without an identity no grant * is bound and any IDENTITY key the caller supplied is REMOVED, so the * binding evaluator answers with missing data exactly as the server does for * an anonymous request, only a definition whose policies need no identity can * pass, and a caller can never inject an identity the document did not prove. * Grants without the identity they belong to are refused. * * The REALM_MATCH data key follows the server's own three-way rule: a * resource that carries a realm passes it (null for a global row, which * `own` denies), a resource with no realm dimension passes nothing and reach * neutral-passes. `preEvaluate` / `preEvaluateOneOf` are the pre-gate and * enforce reach only when that key is present. `compile` returns the * allow/deny/conditional/post contract; a `post` collection query must be * rejected or evaluated over every candidate before paging. The supplied * identity is authoritative; `options.decisionStrategy` is forwarded and the * policy include, exclude and pending options are refused. * * The policy type set is open (#3635): `options.validators` decides which * trees project and `options.evaluators` how they evaluate, the built-in * registries by default. A custom type needs both, the validator the server * projected it with and the evaluator the server decides it with; given only * the first it projects and then denies. The binding evaluator is always this * function's own, since it is what binds the introspected grants. */ export declare function createAuthorizationEvaluator(input: AuthorizationEvaluatorInput, options?: AuthorizationEvaluatorOptions): Promise; /** * An `IPermissionEvaluator` over the answer `POST /authorization/check` * served: the caller's own verdicts, paired with the realms they hold in. * * It is what a PUBLIC client gets where the catalog is out of reach. A public * client holds no secret, so it can obtain no `client_credentials` token and * has no credential of its own for the catalog's gate to be satisfied by; * publishing every policy predicate to it instead would be the wrong trade. * The verdicts are computed by the server from the same grants and the same * evaluators a request runs, so this is authoritative where the name-only * fallback it replaces is merely coarse. * * Two properties follow from the answer being a pre-gate: * * It is an UPPER BOUND, so `evaluate` and `evaluateOneOf` answer exactly what * the pre-gate pair answers. A check that depends on a resource row belongs to * whoever holds the row, and the server decides it there; answering such a * check here would mean inventing a verdict. That is the same bound the * name-only fallback already had, so nothing that gates on it loosens. * * And a resource realm is matched against what the REQUEST asked about: a * `realmMatch` naming a realm the request never carried is in no entry's list * and therefore denies. That is fail-closed by construction rather than by a * rule, and it is why a caller must ask about the realms its UI will ask * about. */ export declare function createAuthorizationCheckEvaluator(input: AuthorizationCheckEvaluatorInput): Promise; //# sourceMappingURL=module.d.ts.map