---
title: "API7 Gateway 3.10.9: Require the Whole Keycloak Permission Contract - API7.ai"
description: "Upgrade Keycloak API authorization safely by testing every required resource, scope, and HTTP-method scope before API7 Gateway 3.10.9 rollout."
url: "https://api7.ai/blog/api7-3.10.9-keycloak-permission-contracts"
---

[Blog](https://api7.ai/blog)

[Products](https://api7.ai/category/products)[Technology](https://api7.ai/category/technology)[Ecosystem](https://api7.ai/category/ecosystem)[Case Study](https://api7.ai/category/usercase)[Team & Community](https://api7.ai/category/community)

Search

⌘ + K

[Blog](https://api7.ai/blog)

Products

# API7 Gateway 3.10.9: Require the Whole Keycloak Permission Contract

November 2, 2026

[Products](https://api7.ai/category/products)

## Key Takeaways

- [API7 Gateway 3.10.9](https://docs.api7.ai/api7-gateway/release-notes#3109), released on October 29, 2026, changes Authz Keycloak from accepting a combined positive decision to checking the complete permission list returned by Keycloak.
- A route that requests several permissions or scopes now forwards a request only when every requested resource and scope is granted. A partial grant returns `HTTP 403`, or redirects to `access_denied_redirect_uri` when configured.
- With `http_method_as_scope: true`, the request method is an additional required scope even when the static permission already lists scopes. Scope names are also sent without surrounding spaces.
- A successful token-endpoint response that cannot be decoded now becomes `HTTP 503`; explicit `401`, `403`, and other error responses remain distinct failure paths.
- Inventory multi-permission routes and run both allow and deny tests against a 3.10.9 canary. During a mixed-version rollout, older and newer Data Planes can make different decisions for the same partial grant.

An authorization rule is a contract, not a bag of optional hints. If a payment route requires both `payments#view` and `payments#refund`, a caller who holds only `view` does not satisfy the route's declared policy—even if the identity provider can return a positive decision for part of the request.

That boundary is the focus of the Authz Keycloak breaking change in API7 Gateway 3.10.9. Earlier behavior asked Keycloak to decide on all requested permissions together and forwarded the request when at least one was granted. The 3.10.9 Data Plane instead asks for the granted permission list and checks every requested item before the request can reach the upstream.

This is a security-correctness improvement, but it is also an availability change for callers whose grants never matched the complete route configuration. The safe upgrade path is to make the permission contract visible, test its negative cases, and update either the Keycloak grants or the route requirements before the new Data Plane enters production rotation.

The measured capture below comes from an isolated run of the real API7 Gateway 3.10.9 Data Plane. A simulated Keycloak-compatible UMA endpoint returned controlled partial and complete permission lists, and a simulated upstream recorded whether the request arrived. The partial grant stopped with `HTTP 403`; the complete grant returned `HTTP 200` with `X-Demo-Upstream-Reached: true`. The upstream record also confirms that the demo removed the bearer token before proxying. This proves the gateway's comparison and delivery boundary for the stated setup; it does not validate a production Keycloak policy or a Dashboard workflow.

![Measured API7 Gateway 3.10.9 results: a partial Keycloak grant returns 403 before the upstream, while a complete grant returns 200 and reaches the upstream](https://static.api7.ai/uploads/2026/11/03/LMRZBaJ8_api7-3.10.9-keycloak-runtime-results.webp?imageMogr2/format/webp)

*Measured on API7 Gateway 3.10.9 with demo-only tokens and simulated Keycloak-compatible and upstream services. The same run also preserved a simulated token-endpoint `401` and returned `503` for an undecodable successful response.*

[Open the full-resolution runtime capture.](https://static.api7.ai/uploads/2026/11/03/LMRZBaJ8_api7-3.10.9-keycloak-runtime-results.webp)

```
sequenceDiagram
    participant C as API Client
    participant G as API7 Gateway 3.10.9
    participant K as Keycloak
    participant U as Upstream API
    C->>G: Bearer token + request
    G->>K: Requested resources and scopes
    K-->>G: Granted permission list
    G->>G: Compare every requested item
    alt Complete grant
        G->>U: Forward request
        U-->>C: Upstream response
    else Missing resource or scope
        G-->>C: HTTP 403 or configured redirect
    end
```

The diagram shows the decision boundary, not the whole Keycloak policy lifecycle. Keycloak still evaluates its policies; API7 Gateway checks whether the returned grant list covers the route's complete request.

## Authorization Must Be a Conjunction, Not a Partial Match

The affected configurations have a common shape: the route asks for more than one authorization condition.

```
{
  "authz-keycloak": {
    "token_endpoint": "https://keycloak.example/realms/platform/protocol/openid-connect/token",
    "client_id": "payments-api",
    "permissions": [
      "payments#view",
      "payments#refund"
    ],
    "http_method_as_scope": false
  }
}
```

On 3.10.9, the plugin requests Keycloak's `permissions` response mode, then matches each requested resource by name or ID and checks all of its scopes. Only a complete match continues through the gateway.

The change also closes two less obvious gaps:

1. `permissions: ["payments#view, refund"]` now requires both `view` and `refund`. The spaces around scope names are removed before the request to Keycloak, so a scope whose first character was a space before `refund` is no longer ignored as a differently named scope.
2. When `http_method_as_scope` is enabled, the HTTP method is appended to the static permission's scopes. A `DELETE` request for `payments#view` therefore needs both `view` and `DELETE`; `view` alone is insufficient.

These are runtime checks, not Dashboard-form checks. Seeing the expected fields in the Control Plane proves that the route was configured; it does not prove that a limited caller is denied or that the full-grant caller reaches the upstream.

The configuration capture shows the Authz Keycloak plugin excerpt from the standalone YAML route loaded for the isolated run. It exercises one permission containing the two comma-separated scopes `view` and `refund`, and shows that a post-function removes the caller's bearer token after authorization. The complete retained route also contains its ID, URI, host, method, upstream, and the full post-function. This is configuration evidence from the Data Plane, not a Dashboard screenshot; a version-matched Dashboard capture would show where the same fields are entered, but still would not prove the `403`/`200` outcomes above.

![API7 Gateway 3.10.9 Authz Keycloak plugin configuration excerpt requiring both view and refund scopes](https://static.api7.ai/uploads/2026/11/03/NTRH0COD_api7-3.10.9-keycloak-config.webp?imageMogr2/format/webp)

*The Token endpoint in this capture is a simulated Keycloak-compatible service. The route configuration and gateway image are version-matched; no production credentials or customer data are used.*

[Open the full-resolution configuration capture.](https://static.api7.ai/uploads/2026/11/03/NTRH0COD_api7-3.10.9-keycloak-config.webp)

## Read the Result Matrix Before You Upgrade

The corresponding public Apache APISIX change adds a [pinned integration test](https://github.com/apache/apisix/blob/39672ef13d419479bf27fc16d942a7ac2bdd3a49/t/plugin/authz-keycloak3.t#L182-L271) for a caller with a limited grant and a caller with the complete fixture grant. Its plugin CI shard ran that test and finished with [`Result: PASS`](https://github.com/apache/apisix/actions/runs/40458510253/job/122037346838).

| Route requirement                         | Fixture grant       | Request  | Observed status |
| ----------------------------------------- | ------------------- | -------- | --------------- |
| `view` and `delete` permissions           | `view` only         | `GET`    | `403`           |
| `view` and `delete` permissions           | Both permissions    | `GET`    | `200`           |
| Same permissions in reverse order         | `view` only         | `GET`    | `403`           |
| One permission with `view, delete` scopes | `view` only         | `GET`    | `403`           |
| One permission with `view, delete` scopes | Both scopes         | `GET`    | `200`           |
| `view` plus method scope                  | `view` and `GET`    | `GET`    | `200`           |
| `view` plus method scope                  | `view` only         | `DELETE` | `403`           |
| `view` plus method scope                  | `view` and `DELETE` | `DELETE` | `200`           |

This matrix is runtime evidence for the stated fixture, not proof that an organization's Keycloak policies express its intended business rules. The `200` rows show that the fixture reached its upstream with the complete grant; the `403` rows show that the partial grant stopped at the gateway.

## Inventory the Contracts That Can Change

Before upgrading, search route and service configurations that enable Authz Keycloak and classify these shapes:

- more than one entry in `permissions`;
- more than one comma-separated scope in an entry;
- `http_method_as_scope: true` together with static scoped permissions; and
- scope strings with leading or trailing spaces.

For every affected route, build a small contract table with the resource, required scopes, HTTP methods, Keycloak role or policy that grants them, and at least one caller expected to be denied. Do not simply grant every missing permission to preserve an old `200`: first confirm that the route's declared contract is intentional.

Test both permission orderings when generated configuration can reorder arrays. The 3.10.9 comparison is order-independent, but exercising the generated result catches tooling that accidentally drops or rewrites an entry before it reaches the gateway.

## Separate Denial, Redirect, and Authorization-Service Failure

Not every non-`200` response means the same thing:

- **Incomplete grant:** The gateway returns `HTTP 403` with the access-denied response. When `access_denied_redirect_uri` is configured, it returns the existing `HTTP 307` redirect instead.
- **Invalid or expired caller token:** A `401` response from the Keycloak token endpoint remains `401`.
- **Other token-endpoint error:** Responses at or above `400` are returned through their corresponding error path.
- **Undecodable successful response:** If the token endpoint answers successfully but the permission list cannot be decoded, the gateway returns `HTTP 503`. It does not treat malformed data as authorization.

Monitor these paths separately. A rise in `403` after the canary begins serving traffic points to a grant/requirement mismatch. A `503` points to the authorization-service response or integration path. Combining them into one generic “Keycloak failure” alert makes the upgrade harder to diagnose.

The [Authz Keycloak reference](https://docs.api7.ai/hub/authz-keycloak) documents the configuration surface, and the official 3.10.9 release notes are the API7 product/version evidence. The corresponding public [Apache APISIX source change and review](https://github.com/apache/apisix/pull/14098) provide inspectable implementation and test evidence for the same documented behavior; the public commit hash is not presented here as the API7 3.10.9 binary's source revision.

## Roll Out the New Contract Without Intermittent Decisions

The corrected comparison runs in the Data Plane. During a rolling upgrade, a 3.10.8 instance can still accept a partial grant that a 3.10.9 instance denies. If both versions receive production traffic, the same token and route can therefore appear to fail intermittently depending on which instance handled the request.

Use the [API7 Gateway rolling-upgrade procedure](https://docs.api7.ai/api7-gateway/upgrade-guides/rolling-upgrade) with an authorization-specific gate:

1. Deploy a 3.10.9 canary outside the production load balancer.
2. Apply the same route configuration and use controlled test identities with full and partial grants.
3. Verify the upstream receives only the full-grant requests; check the client-visible `403`, `307`, `401`, and `503` paths separately where they apply.
4. Correct unintended route requirements or Keycloak grants, then rerun the negative tests.
5. Add the canary to production traffic and monitor status codes by Data Plane version before expanding the rollout.
6. Remove older Data Planes only after the complete grant matrix passes and expected callers no longer depend on partial authorization.

API7 Gateway 3.10.9 makes the route's Keycloak permission contract literal: every requested resource and scope must be present in the grant returned by Keycloak. Treat that as an opportunity to replace assumed authorization with a small, repeatable contract suite. Review the [full 3.10.9 release notes](https://docs.api7.ai/api7-gateway/release-notes#3109), validate the affected routes on a canary, and then [evaluate API7 Enterprise](https://api7.ai/enterprise) for centrally managed gateway policy and operations.

Tags:

[API7 Gateway](https://api7.ai/tags/api7-gateway)

[API Security](https://api7.ai/tags/api-security)

[Authorization](https://api7.ai/tags/authorization)

[Keycloak](https://api7.ai/tags/keycloak)

Share article link

Share

Related Posts

[![API7 Gateway 3.10.4: Make Every Trust Boundary Explicit](https://static.api7.ai/uploads/2026/08/03/kKnWR0sJ_api7-gateway-3-10-4-explicit-trust-boundaries.webp)](https://api7.ai/blog/api7-gateway-3-10-4-explicit-trust-boundaries)

## [API7 Gateway 3.10.4: Make Every Trust Boundary Explicit](https://api7.ai/blog/api7-gateway-3-10-4-explicit-trust-boundaries)

[![API7 Gateway 3.10.3: Safer Enterprise Upgrades by Design](https://static.api7.ai/uploads/2026/07/21/gd7buVTD_3.10.3.webp)](https://api7.ai/blog/api7-gateway-3-10-3-safer-enterprise-upgrades)

## [API7 Gateway 3.10.3: Safer Enterprise Upgrades by Design](https://api7.ai/blog/api7-gateway-3-10-3-safer-enterprise-upgrades)

Table of Contents

- [Key Takeaways](#key-takeaways)
- [Authorization Must Be a Conjunction, Not a Partial Match](#authorization-must-be-a-conjunction-not-a-partial-match)
- [Read the Result Matrix Before You Upgrade](#read-the-result-matrix-before-you-upgrade)
- [Inventory the Contracts That Can Change](#inventory-the-contracts-that-can-change)
- [Separate Denial, Redirect, and Authorization-Service Failure](#separate-denial-redirect-and-authorization-service-failure)
- [Roll Out the New Contract Without Intermittent Decisions](#roll-out-the-new-contract-without-intermittent-decisions)

## Related Posts

[![API7 Gateway 3.10.8: Upgrade Identity Without Breaking Trust Boundaries](https://static.api7.ai/uploads/2026/10/19/z3DK9b7U_api7-3.10.8-identity-upgrade-runbook.webp)](https://api7.ai/blog/api7-3.10.8-identity-upgrade-runbook)

Products

October 19, 2026

#### [API7 Gateway 3.10.8: Upgrade Identity Without Breaking Trust Boundaries](https://api7.ai/blog/api7-3.10.8-identity-upgrade-runbook)

Use contract tests to upgrade API7 Gateway 3.10.8 identity flows across OIDC introspection, SAML callbacks, replay handling, and browser state.

[API7 Gateway](https://api7.ai/tags/api7-gateway)

[Authentication](https://api7.ai/tags/authentication)

[API Security](https://api7.ai/tags/api-security)

[![API7 Gateway 3.10.7: Close the Trust Gaps From Client to Upstream](https://static.api7.ai/uploads/2026/09/21/2CrEEFPQ_api7-3.10.7-client-upstream-trust.webp)](https://api7.ai/blog/api7-3.10.7-client-upstream-trust)

Products

September 22, 2026

#### [API7 Gateway 3.10.7: Close the Trust Gaps From Client to Upstream](https://api7.ai/blog/api7-3.10.7-client-upstream-trust)

API7 Gateway 3.10.7 closes trust gaps in Basic Auth, JWE handling, duplicate headers, TLS passthrough, and upstream certificate checks.

[API7 Gateway](https://api7.ai/tags/api7-gateway)

[API Security](https://api7.ai/tags/api-security)

[Authentication](https://api7.ai/tags/authentication)

[![API7 Gateway 3.10.5: Make Every Control Identity-Bound](https://static.api7.ai/uploads/2026/08/18/k1NJu3cf_3.10.5-make-control-identity-bound.webp)](https://api7.ai/blog/api7-gateway-3-10-5-identity-bound-controls)

Products

August 18, 2026

#### [API7 Gateway 3.10.5: Make Every Control Identity-Bound](https://api7.ai/blog/api7-gateway-3-10-5-identity-bound-controls)

API7 Gateway 3.10.5 strengthens API Gateway security by binding configuration, metrics, portal access, and identity flows to verified authority.

[API7 Gateway](https://api7.ai/tags/api7-gateway)

[API Security](https://api7.ai/tags/api-security)

[API Management](https://api7.ai/tags/api-management)
