Case study 03 · Banking · Corporate payments

Fine-grained authorization for corporate banking

Who may act on which account (ReBAC, delegated by the customer's admin) and whether this payment is allowed (limits, separation of duties, dual control, step-up MFA). Policies unit-tested and explainable.

18relationship model checks
14policy unit tests
10end-to-end tests

The problem

Corporate banking authorization is more than roles. “Ana can create payments on the operations account, Ben can approve up to €50k, anything above €10k needs two approvers from different departments and fresh MFA, and the customer’s own admin decides who works on which account.” Roles in tokens cannot express this. Rules scattered through application code cannot be audited or tested on their own.

Approach

flowchart LR
    user(["Corporate user"]) -- "OIDC (acr silver / gold)" --> kc["Keycloak"]
    user -- "token" --> api["Payments API (PEP)"]
    api -- "check / list" --> fga["OpenFGA<br/>relationships"]
    api -- "decision" --> opa["OPA<br/>transaction rules"]
  • OpenFGA for relationships: company roles, account ownership, per-account grants. Derived permissions such as can_approve = operator AND approver from owner. The customer’s admin grants access but cannot move money.
  • OPA for transaction rules: approval limits, separation of duties, dual control across departments, maximum amounts. Each deny returns its reasons.
  • Step-up authentication: when an approval needs stronger authentication, the API returns the standard RFC 9470 challenge, and Keycloak’s level-of-authentication flow asks only for the missing OTP.
  • Attributes from the source of truth: limits and departments come from policy data, not token claims, so changes apply on the next request.

Key decisions

Decision Why
Two engines: OpenFGA + OPA Relationships need graph queries and listing; transaction rules need context and explanations
Ask for step-up only when it is the only blocker No MFA prompt for a payment that would be refused anyway
MFA freshness (auth_time ≤ 5 min) for high value Stops “MFA once in the morning, approve all day”
Fail closed An undefined or failed decision is a deny

Results

  • 18 relationship checks + 2 listing assertions run against the OpenFGA model in CI; 14 Rego unit tests cover every rule.
  • 10 end-to-end tests use real logins: a step-up that asks only for OTP, dual control completed by a second department, an approval limit that holds even with strong authentication, delegated administration, and no cross-company access.
  • Every decision is logged with an OPA decision ID for audit and dispute handling.

← All case studies