• This hook provides more flexibility than the <Authz/> component, allowing you to work with authorization decisions directly in your code.

    Parameters

    • Optionalpath: string

      The policy path. If unset, will be evaluating the server's default decision.

    • Optionalinput: Input

      The input to the policy evaluation.

    • OptionalfromResult: ((_?: Result) => boolean)

      Optional result unwrapping function.

        • (_?): boolean
        • Parameters

          Returns boolean

    Returns UseAuthzResult<Result>

  • For evaluating a dynamic number of requests, useAuthz can be supplied with an array of inputs of the form {path, input, fromResult}.

    Parameters

    • queries: {
          fromResult?: ((_?: Result) => boolean);
          input?: Input;
          path?: string;
      }[]

      An array of { path, input, fromResult } objects. All keys are optional, but if batching is enabled, path cannot be omitted.

    Returns UseAuthzResult<Result>[]