HTTP authorization
Attach to:
HTTP authorization Authorization (AuthZ) The process of determining what actions an authenticated user or service is allowed to perform. Agentgateway supports HTTP authorization, MCP authorization, and external authorization services. allows defining rules to allow or deny requests based on their properties, using CEL expressions.
Policies can define allow, deny, and require rules. When evaluating a request:
- If there are no policies, the request is allowed.
- If any
denypolicy matches, the request is denied. - All
requirepolicies must match. If anyrequirepolicy does not match, the request is denied. - If any
allowpolicy matches, the request is allowed. - If only
denyrules exist (noallowrules), unmatched requests are allowed (denylist semantics). - If
allowrules exist but none matched, the request is denied (allowlist semantics).
authorization:
rules:
- allow: 'request.path == "/authz/public"'
- deny: 'request.path == "/authz/deny"'
- require: 'jwt.aud == "my-service"'
# legacy format; same as `allow: ...`
- 'request.headers["x-allow"] == "true"'Require rules
The require rule type provides clearer semantics than double-negative deny rules for expressing mandatory conditions. For example, the following two configurations are equivalent, but require is easier to read:
# Using require (recommended)
authorization:
rules:
- require: 'jwt.aud == "my-service"'
# Equivalent using deny (less clear)
authorization:
rules:
- deny: 'jwt.aud != "my-service"'Unlike allow rules, all require rules must match for the request to proceed. Use require rules to express invariants like “all requests must have a valid audience claim.”