-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
OIDC: Fetch UserInfo to get EmailVerified if necessary #2493
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
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.
I think this looks reasonable, is it confirmed that some of the providers (like Okta), sets the email verified in the user info?
Question for further improvement, is there more info we potentially should "fall back" to getting from userinfo if we dont get it in the claim?
Could you please add a changelog entry?
Okta's knowledge base indicates that they do this (https://support.okta.com/help/s/article/how-to-return-the-email-verified-claim), and I have confirmed the behavior through live testing. The only other one I've tested is Keycloak, but keycloak also includes email_verified in the id token response.
Good question! In theory we could try UserInfo for any of the standard claims that headscale uses: name, email, picture, preferred_username.
Yes, coming right up. |
eaec48d to
3643914
Compare
|
No rush, but I think this is ready for another look. |
|
@benley looks good, will merge when the TestUpdateHostnameFromClient passes, mostly a formality. Would you be up for a PR to use this info for the other fields too? I imagine we prioritise the claims, and then fall back to userinfo. |
Sure, I can followup with a second PR to do the rest of the fields. Thank you for merging this one! |
(cherry picked from commit b5953d6)
Some OIDC providers (including Okta) do not include an
email_verifiedclaim in ID tokens, so headscale will never trust their email addresses. The OIDC spec says that the set of "standard claims" can be returned in either the UserInfo response or the ID token, so we can try requesting UserInfo if necessary to find theemail_verifiedclaim that we're looking for. If this also fails, the behavior of headscale is unchanged from before.Please let me know if this approach looks acceptable, and I can try to add test coverage and update docs as needed.
Related to #2333 and #2295