Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing ring-req argument to authorized?-fn function call #385

Closed
wants to merge 1 commit into from

Conversation

viesti
Copy link
Contributor

@viesti viesti commented Jan 20, 2021

The documentation on make-channel-socket-server! says:

    :authorized?-fn    ; ?(fn [ring-req]) -> When non-nil, (authorized?-fn <ring-req>)
                       ; must return truthy, otherwise connection requests will be
                       ; rejected with (unauthorized-fn <ring-req>) response.
                       ;
                       ; May check Authroization HTTP header, etc.

But the implementation doesn't actually pass ring-req argument to the supplied authorized?-fn function. So fixed that by adding the missing argument to the function call :).

@viesti viesti changed the title Pass ring-req to authorized?-fn Add missing ring-req argument to authorized?-fn function call Jan 20, 2021
@ptaoussanis
Copy link
Member

Merging manually, thanks Kimmo!

@viesti
Copy link
Contributor Author

viesti commented Jan 22, 2021

Thank you! Actually, I ended up doing the check in a middleware that is wrapped around the handlers that sente creates, since I used that middleware elsewhere too. That lead me to think if csrf, or other checks could be delegated to a middleware, maybe then documented also in sente.

Anyway, this fix is a good thing to keep :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants