8000 Registration with email verification - corner case scenario for pre-a… by mposolda · Pull Request #48208 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Registration with email verification - corner case scenario for pre-a… - #48208

Merged
mposolda merged 2 commits into
keycloak:mainfrom
mposolda:48206-register-verify-email
Apr 20, 2026
Merged

mposolda merged 2 commits into
keycloak:mainfrom
mposolda:48206-register-verify-email

Conversation

@mposolda
@mposolda mposolda commented Apr 17, 2026 •
Copy link
Copy Markdown
Contributor

…ccount takeover

closes #48206

PR adds new authentication session note NEW_USER_REGISTERED in case that user self-registration happens in this authentication session (EG. authSession1) . When verify-email is done in the meantime for the user in different browser (by some different authentication session like authSession2 ), then authSession1 is not able to continue after verify-email.

@mposolda mposolda self-assigned this Apr 17, 2026
@mposolda
mposolda requested a review from a team as a code owner April 17, 2026 15:06
@mposolda
mposolda requested a review from rmartinc April 20, 2026 06:56
@rmartinc rmartinc left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks a lot @mposolda!

Approved, maybe deleting the auth session was better. Asking to verify again is a bit weird. But, as it's a corner case, it's OK to me.

return;
// When triggered during registration, make sure to add requiredAction also to the authSession. If email is later verified in different authSession, this authSession should not continue
if ("true".equals(context.getAuthenticationSession().getAuthNote(NEW_USER_REGISTERED))) {
context.getAuthenticationSession().addRequiredAction(UserModel.RequiredAction.VERIFY_EMAIL);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nitpick. Maybe just deleting auth session and force to restart the login was better. But this is enough to fix the issue.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, that is another variant I've considered and agree that it is likely better. I've updated PR for restart current authentication session in case that email was verified in other authSession in the meantime. Used separate commit, so it is possible to easily see the changes. Could you re-review?

…ccount takeover

closes keycloak#48206

Signed-off-by: mposolda <mposolda@gmail.com>
Signed-off-by: mposolda <mposolda@gmail.com>
@mposolda
mposolda force-pushed the 48206-register-verify-email branch from 600f7e2 to 6cc7752 Compare April 20, 2026 09:14
@rmartinc rmartinc left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @mposolda! LGTM!

@mposolda
Copy link
Copy Markdown
Contributor Author

@rmartinc Thanks!

@mposolda
mposolda merged commit 64106c6 into keycloak:main Apr 20, 2026
85 checks passed
@stianst stianst mentioned this pull request Jun 1, 2026
sashyo pushed a commit to tide-foundation/keycloak-IGA that referenced this pull request Jul 20, 2026
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.

Registration with email verification - corner case scenario for pre-account takeover

2 participants

0