-
Notifications
You must be signed in to change notification settings - Fork 0
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
[IOPID-536] : Migration from cookies to session storage #10
Conversation
… session storage as token container, removing logic for using cookies as a storage for token and user info
Jira Pull Request LinkThis Pull Request refers to the following Jira issue IOPID-536 |
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.
A couple of suggestions ;)
Co-authored-by: Fabio Bombardi <[email protected]>
Co-authored-by: Fabio Bombardi <[email protected]>
Co-authored-by: Fabio Bombardi <[email protected]>
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.
Added few suggestions
Co-authored-by: Fabio Bombardi <[email protected]>
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.
LGTM
After accepting the hint to use isBrowser() in useToken hook, I realized that the utility function wasn't automatically imported. After rebuilding the solution, I noticed that the useEffect in the session provider was being triggered too many times due to the various changes made. To avoid this problem, I had to change the dependency array items, we had also introduced pathName instead of window.location. After testing, everything now seems to be working fine. I kindly request a final review before proceeding with the merge. Thank you! |
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.
From a static code check POV, LGTM!
Short description
As discussed in the meeting, we are not allowed to store tokens and user info inside the cookie. The purpose of these fixes is to change the logic where the cookies were intercepted from the header of the request in the middleware. Since the middleware has no chance to get data from session storage, we migrated the logic to the session provider to retrieve the session storage from there.
List of changes proposed in this pull request
How to test
Try to log in through /access or /logoutInit using the SPID and check if the token and user object are stored in session storage instead of cookies.
To log in, use hub-spid-login as SP or force it with the following link+token:
http://localhost:3000/validateSession#token=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Imp3dF84Njo3NDoxZTozNTphZTphNjpkODo0YjpkYzplOTpmYzo4ZTphMDozNTo2ODpiNSJ9.eyJlbWFpbCI6InBpcHBvQHRlc3QuZW1haWwuaXQiLCJmYW1pbHlfbmFtZSI6InF3ZXJ0eSIsImZpc2NhbF9udW1iZXIiOiJRV1JQUFA4MEEwMUg1MDFGIiwibmFtZSI6InBpcHBvIiwiZnJvbV9hYSI6ZmFsc2UsInVpZCI6IjgzODQzODY0LWYzYzAtNGRlZi1iYWRiLTdmMTk3NDcxYjcyZSIsImxldmVsIjoiTDIiLCJpYXQiOjE2ODk2OTI4ODcsImV4cCI6MTY4OTcyNTI4NywiYXVkIjoiYXBpLmRldi5zZWxmY2FyZS5wYWdvcGEuaXQiLCJpc3MiOiJTUElEIiwianRpIjoiXzk0ZDJmZTYyMDQ2NTUyODRjMGRjIn0.EDbsdpQgXlJSzyVgRqZy7yuUILe5FUlaerC3n1gv6SQrNvljXJxgm3GTv0912UQ6VV85e4oxGgc4LrcvpyLYZcgVe-5-2gNfbYNIPbIWqicaX4GPucQrSq47H0NEIaAv6-3qI2l1IhdH--72zUls_911RoAg_JdINr7em0vxy7wEoqjWOxgEsfQhEauT8oyRV6dDDied5zA9YQPy7a7KlhvI6juwS4sCdFnaonNzhBcZnqW4qzpec2NaAb1xJuHnnTp_tdMz6zExEhupeopmYdtIzYHUvxfohHr1L7eDRzi5RKEUfnRIldajfQEX_NUL9UTU4EkCcwUs-rSIKskQog