traefik-plugins / traefik-jwt-plugin

Traefik plugin which checks JWT tokens for required fields. Supports Open Policy Agent (OPA) and signature validation with JWKS
Apache License 2.0
98 stars 34 forks source link

[proposal] OPA driven HTTP status code #33

Closed ievgenii-shepeliuk closed 1 year ago

ievgenii-shepeliuk commented 2 years ago

Hello

Sometimes it's required to return non 403 code but 401 instead, for example to enforce 2FA/MFA cases. Currently it's impossible because on token / OPA error check the HTTP status code is hardcoded to 403.

Also it could be useful to make success status code OPA driven as well, i.e. extract it from configurable field of OPA response. So, OPA can force redirect to some resource for example.

WDYT ? I am read to attempt to provide a PR for this.