Skip to content

Use Directus JWT to login without hostname #3921

Answered by badlop
macntech asked this question in Questions
Discussion options

You must be logged in to vote

I can think a very simple and which patch would be something like this. But, as it doesn't check the server, it would allow this token to be used to login to username "longuseridstring" in any of the local hosts:

diff --git a/src/ejabberd_auth_jwt.erl b/src/ejabberd_auth_jwt.erl
index d1fe4d15a..1c93d3410 100644
--- a/src/ejabberd_auth_jwt.erl
+++ b/src/ejabberd_auth_jwt.erl
@@ -106,7 +106,11 @@ check_decoded_jwt(true, Fields, _Signature, Server, User) ->
         {ok, SJid} when is_binary(SJid) ->
             try
                 JID = jid:decode(SJid),
-                JID#jid.luser == User andalso JID#jid.lserver == Server
+                case {JID#jid.luser, JID#jid.lserver} of
+

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by badlop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants