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

JNG-5697 On module change when different user have valid key invalida… #389

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

robertcsakany
Copy link
Member

@robertcsakany robertcsakany commented Apr 25, 2024

BugJNG-5697 On modul switch token have to be revoked when it is related to different user

…te it

@robertcsakany robertcsakany requested a review from noherczeg April 25, 2024 12:08
@robertcsakany robertcsakany self-assigned this Apr 25, 2024
window.location.reload();
}
}
}, [useSearchParams, getUser]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useSearchParams is not used, should not be needed in the dependencies array.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getUser also never changes, so the dependency array should be empty I think.

clearSecurityStorage();
const { origin } = window.location;
window.location.href = origin + '/' + applicationKey;
window.location.href = origin + '/' + applicationKey + "?user=" + tokenUser ;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since tokenUser could be an email address, we might need to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent it to make sure special characters are encoded in the param. Not sure, we should check.

const tokenUser = profile?.preferred_username;
if (tokenUser != null && tokenUser === forcedUser) {
clearSecurityStorage();
window.location.reload();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ?user search param should be removed before we reload I think since we won't need it any more.

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

Successfully merging this pull request may close these issues.

2 participants