Expand description
Keycloak UMA authorization plugin (authz-keycloak).
Ports a faithful subset of Apache APISIX’s authz-keycloak plugin: the
UMA 2.0 permission check against a Keycloak token endpoint. For each
request the plugin takes the caller’s bearer access token and asks Keycloak
whether it grants the configured permissions, using the
urn:ietf:params:oauth:grant-type:uma-ticket grant with
response_mode=decision — exactly the request APISIX’s evaluate_permissions
builds. A 200 decision allows the request; anything else denies it.
§Implemented subset
- Static, pre-configured
permissions(with optionalhttp_method_as_scope). policy_enforcement_mode(ENFORCING/PERMISSIVE) for the empty-permission case.ssl_verifyandtimeout.
§Deliberately NOT ported (documented deviations)
- Discovery (
discoveryURL): configuretoken_endpointdirectly. lazy_load_paths/ resource-registration lookups and the service-account (client_credentials) token dance — no dynamic resource resolution.password_grant_token_generation_incoming_uritoken minting.- Response/token caching and
access_denied_redirect_uriredirects.
All denials and callout errors map to 403 (code AUTHZ_KEYCLOAK_DENIED)
routed through the node’s error port.
Structs§
- Authz
Keycloak Plugin - Performs a Keycloak UMA permission check per request.
Constants§
Functions§
- decision_
allows 🔒 - Maps a Keycloak UMA response status to an allow/deny decision: only
200(the decision endpoint’s “granted” response) allows. - encode_
uma_ 🔒body - Encodes the UMA permission-check request body as
application/x-www-form-urlencoded, repeatingpermissionper entry. - fetch_
bearer 🔒 - Extracts the bearer token from the
Authorizationheader, normalizing to aBearer-prefixed value (mirroring APISIX’sfetch_jwt_token). - form_
encode 🔒 - Percent-encodes a value for
application/x-www-form-urlencodedbodies (unreserved characters pass through; space becomes+). - scoped_
permissions 🔒 - Applies
http_method_as_scope: appends#<method>to each permission, or, <method>when a scope is already present (matching APISIX’s logic).