Skip to content

Conversation

@anoadragon453
Copy link
Member

Fixes #10

This PR reworks the bit where we make a call out to the User Verification Service in order to check a user's provided credentials. Instead of a blocking HTTP call, we now do the call async, allowing Prosody to continue serving requests while we wait for the response.

#9 was an initial attempt to do the same and was quite close! But it had a couple bugs in it, one being the very non-obvious fact that options.body needs to be the JSON string and not be set directly to a table.

Tested with success on my own Jitsi Auth setup. One thing I noticed while doing so is that if verify_room_membership happened to return nil for it's first return argument, the user would be allowed into the Jitsi room. This was due to us only checking whether the return value of isMember was false, rather than checking it was not true. The second commit tackles that problem as a defensive measure.

Signed-off-by: Andrew Morgan andrewm@element.io

Copy link
Member

@jaywink jaywink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks!

@jaywink jaywink merged commit 5d35866 into matrix-org:master May 20, 2021
@anoadragon453 anoadragon453 deleted the anoa/async_http branch May 20, 2021 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mod_auth_matrix_user_verification module needs to be fully async

2 participants