[PR #2493] [MERGED] OIDC: Fetch UserInfo to get EmailVerified if necessary #2691

Closed
opened 2025-12-29 03:22:22 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/juanfont/headscale/pull/2493
Author: @benley
Created: 3/20/2025
Status: Merged
Merged: 3/27/2025
Merged by: @kradalby

Base: mainHead: userinfo-emailverified


📝 Commits (1)

  • 3643914 OIDC: Fetch UserInfo to get EmailVerified if necessary

📊 Changes

2 files changed (+32 additions, -5 deletions)

View changed files

📝 CHANGELOG.md (+4 -0)
📝 hscontrol/oidc.go (+28 -5)

📄 Description

Some OIDC providers (including Okta) do not include an email_verified claim 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 the email_verified claim 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

  • have read the CONTRIBUTING.md file
  • raised a GitHub issue or discussed it on the projects chat beforehand
  • added unit tests
  • added integration tests
  • updated documentation if needed
  • updated CHANGELOG.md

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/juanfont/headscale/pull/2493 **Author:** [@benley](https://github.com/benley) **Created:** 3/20/2025 **Status:** ✅ Merged **Merged:** 3/27/2025 **Merged by:** [@kradalby](https://github.com/kradalby) **Base:** `main` ← **Head:** `userinfo-emailverified` --- ### 📝 Commits (1) - [`3643914`](https://github.com/juanfont/headscale/commit/3643914538f9ce2c1f57d7a2975a4ca416af68e2) OIDC: Fetch UserInfo to get EmailVerified if necessary ### 📊 Changes **2 files changed** (+32 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+4 -0) 📝 `hscontrol/oidc.go` (+28 -5) </details> ### 📄 Description Some OIDC providers (including Okta) do not include an `email_verified` claim in ID tokens, so headscale will never trust their email addresses. The OIDC spec says that the set of ["standard claims"](https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims) can be returned in either the UserInfo response or the ID token, so we can try requesting UserInfo if necessary to find the `email_verified` claim 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 - [x] have read the [CONTRIBUTING.md](./CONTRIBUTING.md) file - [x] raised a GitHub issue or discussed it on the projects chat beforehand - [ ] added unit tests - [ ] added integration tests - [ ] updated documentation if needed - [x] updated CHANGELOG.md --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 03:22:22 +01:00
adam closed this issue 2025-12-29 03:22:22 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#2691