-
Notifications
You must be signed in to change notification settings - Fork 3
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
ISSUE-365: Destroy JWT tokens on logout #412
base: develop
Are you sure you want to change the base?
Conversation
@Ammar-T For the production server, it looks like we will need Ed-Commons to set this up: https://learn.microsoft.com/en-us/azure/azure-cache-for-redis/cache-nodejs-get-started Should I go ahead and make this request? |
@geoffreykwan Would you be able to help us with making the call to log out of SCORE when we log out of CK Board (and vice versa)? |
@Ammar-T I tested running SCORE locally and using SCORE login for CK Board. After entering my credentials on SCORE, I was navigated to a URL and presented with a blank page (http://localhost:4201/sso/login/bm9uY...)
|
To have CK Board sign out of SCORE, you can make a GET request to
Where localhost is the local SCORE server. We might want to add an environment variable to the To have SCORE sign out of CK Board, is there a CK Board endpoint that SCORE can make a request to, to log out of CK Board? |
Thanks @geoffreykwan, I like that idea of a SCORE_SERVER_ADDRESS environment variable. I suppose we could update the update the SCORE_SSO_ENDPOINT as well to only require the path (e.g., /sso/ckboard) and get the server address from that new variable? @Ammar-T, I believe you said we had a CK Board endpoint that SCORE could make requests to for logout, right? |
Yea if we have a SCORE_SERVER_ADDRESS environment variable (set to |
@geoffreykwan For the SCORE logout endpoint mentioned, is there no additional data that needs to be sent with the request? I'm wondering if anyone hits that endpoint from Postman, for example, who and how would it log them out? Is there no extra data that must be passed in the header/body which would identify the user attempting to logout? |
If you want to log out from Postman, you need to set the SESSION cookie. I think if you make the request to https://score.oise.utoronto.ca/api/logout (or http://localhost/api/logout) from the CK Board client, it would automatically use the SESSION cookie for SCORE. I haven't tested this but I think it should work. If you want to make the request to the SCORE logout endpoint from the CK Board backend, I think you would need to send the SESSION cookie to the backend so that the backend could use it in the logout request. I haven't tested this either. You can manually get the SCORE SESSION cookie by logging into SCORE and then looking at a request header. Here's how to set the SESSION cookie in Postman
|
Thanks for the detailed reply! I'll try this out. |
Figured out how to pass cookies into the backend after having to change a few cors policies, but there's a new problem. Users of CK board never have access to cookies of SCORE, so we're never able to pass in that But, since ckboard and score are both subdomains of the same domain ( I tried finding where this was happening in |
Looks like we only need to set some properties in the
You can see the domain cookie in the |
@JoelWiebe This is ready for re-review, should now work with SCORE login and will also logout users from SCORE if they logout from CK-Board. @geoffreykwan The endpoint you would need to hit to logout CK Board is
|
Cookie is created now on login which is the same as |
ISSUE-432: Do not create trace event when tracing disabled
@geoffreykwan Would you have time to review this PR as well? |
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.
This appears to work for me.
Tested:
- login from CK Board also logs in for SCORE
- logout from CK Board also logs out of SCORE
Great work!
I can't seem to access the CK_SESSION cookie. If I look at the cookies on the browser I only see the SESSION cookie (from SCORE) and not the CK_SESSION cookie. Here is how I'm looking at the cookies
On the CK Board backend I've even tried setting the CK_SESSION cookie parameters to be more relaxed like this (I set httpOnly to false and secure to false) and I still can't see it in the browser.
When I sign out of CK Board it does sign me out of SCORE. I'm still trying to get signing out of SCORE to also sign out of CK Board but I need the CK_SESSION value to do that and I can't seem to obtain it. |
I think I figured out how to get the CK_SESSION cookie to save in the browser. In the CK Board frontend, when the sso login request is made to the CK Board backend, we need to provide the In
Now I can work on having SCORE make the request to sign out of CK Board. |
Oh good catch, I'll update this PR. |
…ab/ck-board into issue-365-logout-backend
I've created a PR on SCORE-API to have SCORE make the request to sign out of CK Board. |
@Ammar-T Are these all of the variables that we need added or updated on our production server? SCORE_SERVER_ADDRESS=https://score.oise.utoronto.ca |
@Ammar-T Just re-requested approval for the redis cache, once approved we can request the changes to environment variables and upgrade perhaps early next week. |
Details
NOTE: For development environments, Redis will have to be running locally. To setup:
npm run dev
andng serve
, we also need to runredis-server
to start the redis server.Comment out first two since we're in the dev environment.
Closes #365