matrix-org / prosody-mod-auth-matrix-user-verification

Matrix user verification auth for Prosody
Apache License 2.0
24 stars 12 forks source link

Convert User Verification Service check to a non-blocking HTTP call #11

Closed anoadragon453 closed 3 years ago

anoadragon453 commented 3 years ago

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