mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-12 19:32:48 -06:00
81858aa542
## What / Why
The examples on the OAuth2/OIDC guide (`docs/docs/oauth-oidc.md`) fail
to compile on current OPA (v1+):
1. `claims := jwt.decode(input.token)[1]` uses an undefined built-in.
The correct name is `io.jwt.decode`, which the same page already uses
correctly further down (`jwt_unverified := io.jwt.decode(input.token)`).
2. The `jwt_verified := jwt_unverified { ... }` and `token := t { ... }`
rules are missing the `if` keyword required before a rule body in Rego
v1, so they fail to parse (`'if' keyword is required before rule body`).
## Changes
- `jwt.decode` -> `io.jwt.decode`
- add `if` before the `jwt_verified` and `token` rule bodies
These are minimal, semantics-preserving fixes so the copy-pasteable
examples work on a current OPA release.
Signed-off-by: Nikhil Jathar <22786232+mailnike@users.noreply.github.com>
Documentation and Website Development
Please see the contributing documentation for information about how to get started contributing to the OPA documentation and website.