Local JWT vs External OAuth2: Balancing Simplicity and Revocation Control
0 reputation · 27 Jul 2020, 06:45 UTC
0 reputation · 27 Jul 2020, 06:45 UTC
Goal: Determine the most appropriate authentication strategy for Gazebo’s web interface, ensuring efficient token lifetime management while preserving least‑privilege access.
Constraints: The current implementation uses JSON Web Tokens (JWT) that include an "exp" claim but lack a built‑in revocation endpoint. An alternative is to integrate an external OAuth2 provider, which offers centralized revocation and single‑sign‑on but requires additional configuration and plugin development.
Uncertainty: Documentation does not recommend a definitive approach for production deployments, leaving the choice between simplicity (local JWT) and enhanced control (OAuth2) unresolved.
What are the trade‑offs between maintaining a simple local JWT system that rejects expired tokens versus adopting an OAuth2 flow that supports token revocation and centralized credential management? Does Gazebo provide any mechanism for revoking JWTs in newer releases, or must a custom revocation endpoint be added? Should least‑privilege role definitions be enforced at the JWT level or only through ROS 2 Security (DDS‑SAS) when using OAuth2?
34775 reputation · 27 Jul 2020, 16:11 UTC
For a single‑operator or small‑team Gazebo web interface, a local JWT scheme with short‑lived access tokens plus a small server‑side denylist is usually the right balance. Move to an external OAuth2/OIDC provider only when you genuinely need SSO, multiple users with audit trails, or immediate revocation guarantees. And enforce least‑privilege roles in the web backend via token claims — ROS 2 Security (DDS‑Security) is orthogonal and does not replace it.
A JWT is self‑contained: once issued, any validator that checks the signature and exp claim will accept it until it expires. There is no callback to the issuer. That means a leaked or logged‑out token stays valid for its full lifetime. Your options to close the gap, in increasing order of complexity:
jti claims) in a fast cache (e.g., Redis) with TTLs matching token expiry, and check it per request. This reintroduces a little server‑side state but is far simpler than OAuth2.An external provider (Keycloak, Auth0, etc.) offers centralized credential management, SSO, and revocation via token introspection (RFC 7662). Two caveats matter for your decision:
There is no widely documented built‑in JWT revocation endpoint in Gazebo’s web tooling, so the safe assumption is that you must add one yourself (denylist or refresh‑token store). However, Gazebo Classic and the newer Gazebo Sim (formerly Ignition) differ substantially, and web components vary by release — before committing, inspect the changelog and web‑server source for your exact version, and test empirically: issue a token, attempt to invalidate it, and confirm whether requests are rejected before exp.
Enforce roles at the JWT/application layer: put role or scope claims in the token and have the web backend check them on every endpoint. ROS 2 Security (SROS2/DDS‑Security) authenticates DDS participants and governs topic‑level permissions inside the robot middleware — it knows nothing about browser users. The two layers complement each other: the web backend, acting as a DDS participant, should itself run under least‑privilege DDS permissions, but user authorization stays in the web tier regardless of whether you use local JWTs or OAuth2.
exp.jti so tokens are individually revocable.Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.