-
Notifications
You must be signed in to change notification settings - Fork 17
Secure WebSocket connection with cookie authentication #621
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
Conversation
…uzzleio/sdk-javascript into 609-http-cookie-authentication-support
… when cookieAuth is enabled
…ocol.enableCookieAuthentication method
… the protocol is called when cookieAuthentication is true
Codecov Report
@@ Coverage Diff @@
## 7-dev #621 +/- ##
==========================================
- Coverage 86.86% 86.30% -0.56%
==========================================
Files 34 34
Lines 1538 1585 +47
Branches 272 279 +7
==========================================
+ Hits 1336 1368 +32
- Misses 146 159 +13
- Partials 56 58 +2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments, good job otherwise 👍
Update: |
# [7.6.0](https://github.com/kuzzleio/sdk-javascript/releases/tag/7.6.0) (2021-04-06) #### Bug fixes - [ [#622](#622) ] Pick first route when multiple non-GET routes of the same size are available ([scottinet](https://github.com/scottinet)) #### New features - [ [#621](#621) ] Secure WebSocket connection with cookie authentication ([Shiranuit](https://github.com/Shiranuit)) - [ [#613](#613) ] Implement index:stats ([Leodau](https://github.com/Leodau)) - [ [#612](#612) ] Implement security:getUserStrategies ([Leodau](https://github.com/Leodau)) #### Enhancements - [ [#620](#620) ] Add kuzzleStack property to KuzzleError ([Aschen](https://github.com/Aschen)) - [ [#617](#617) ] Add suggest to search result ([Aschen](https://github.com/Aschen)) - [ [#614](#614) ] Print deprecation warning from Kuzzle ([MathieuVeber](https://github.com/MathieuVeber)) - [ [#606](#606) ] Add _source property to user objects ([Aschen](https://github.com/Aschen)) ---
What does this PR do ?
This PR adds the support of cookie when using the websocket protocol. To do that, when Kuzzle
cookieAuth
option istrue
, Kuzzle will call the methodenableCookieSupport
from the given protocol. When called, this method will throw if outside the browser or if cookie are not supported by the protocol, otherwise this will change how the protocol behave.For the HTTP protocol it's simple, when enableCookieSupport is called, the protocol will be changing if the request are made with
withCredentials
set totrue
orfalse
depending if he should be able to receive cookies.For the Websocket protocol, this is a bit more complex, when enableCookieSupport is called, the protocol, will be creating a instance of the HTTP Protocol, with the same option (host, port, ssl, ...) as the websocket protocol, after that, when a request
auth:login
,auth:logout
orauth:refreshToken
is made, the protocol will use the HTTP Protocol instead of the websocket client to make the request.[ex: auth:login request is made -> websocket closes the connection -> then send the request with the http protocol -> when a response is received it reopens the connection -> then resolve the request]
TODO: