RFC: Get rid of JWTs #53
RemiBardon
started this conversation in
Ideas
Replies: 1 comment
-
MattJ just submitted XEP-xxxx: OAuth Client Login |
Beta Was this translation helpful? Give feedback.
0 replies
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
-
Tip
TL;DR: Read only what's bold.
Context
After a long discussion with @Jurek in
#dev-pod
on 2024-07-26, I continued thinking about how we handle authentication and authorization in Prose and how we could improve it.@Jurek's argument was that we could simply use Prosody's OAuth 2.0 module directly instead of having our own token system. To that I answered that we didn't do it for the following reasons (I added more details here):
mod_http_oauth2
in fact contains the user's JID, but that's just an implementation detail and we should not rely on it.Now here is what made me realize we could do differently:
mod_tokenauth
, and not implement a custom logic.mod_admin_rest
, which we use for non-XMPP actions (e.g. reloading Prosody), was created before Prosody's permissions system andmod_tokenauth
. I've already proposed that we move away from the unmaintainedmod_admin_rest
and create a brand new "module-agnosticmod_admin_rest
" with modern role and permissions management.mod_http_oauth2
supports OpenID Connect's UserInfo Endpoint. It returns the user's JID.What I suggest
Since OIDC's UserInfo Endpoint can be used to derive a user's JID from an OAuth 2.0 access token, we have no reason to bundle the Prosody access token in a JWT. Therefore, I suggest (credits to @Jurek) that we send Prosody's access token, unencrypted, as the HTTP Bearer token instead of a custom JWT. To get the user's JID when receiving a token, we query Prosody's OIDC UserInfo Endpoint. The rest of Prose Pod API's authorization logic remains unchanged.
Benefits
mod_http_oauth2
, which means:mod_http_oauth2
does.Drawbacks
Footnotes
To avoid needing a log out/log in to apply the new role, and avoid potentially keeping a role with more privileges for the remaining lifetime of the JWT. ↩
Beta Was this translation helpful? Give feedback.
All reactions