Back to Loopback Next

Authorization Component - Decision Matrix

docs/site/Authorization-component-decision-matrix.md

4.0.0-alpha.11.7 KB
Original Source

The final decision to allow access for a subject is done by the interceptor by creating a decision matrix from the voting results (from all the authorizer and voter functions of an endpoint).

The following table illustrates an example decision matrix with 3 votes and corresponding options.

AuthorizerVoter # 1Voter #2OptionsFinal Decision
DenyDenyDenyanyDeny
AllowAllowAllowanyAllow
AbstainAllowAbstainanyAllow
AbstainDenyAbstainanyDeny
DenyAllowAbstain{precedence: Deny}Deny
DenyAllowAbstain{precedence: Allow}Allow
AllowAbstainDeny{precedence: Deny}Deny
AllowAbstainDeny{precedence: Allow}Allow
AbstainAbstainAbstain{defaultDecision: Deny}Deny
AbstainAbstainAbstain{defaultDecision: Allow}Allow
  • Here, if suppose there is an authorizer function and 2 voters for an endpoint.
    • if the authorizer function returns ALLOW, but voter 1 in authorize decorator returns ABSTAIN and voter 2 in decorator returns DENY.
    • In this case, if the options provided while registering the authorization component, provides precedence as DENY, then the access for the subject is denied to the endpoint.