[PR #1120] [MERGED] Fix API auth using PATs with different userIDClaims #14888

Closed
opened 2026-08-05 03:06:32 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/1120
Author: @pascal-fischer
Created: 9/1/2023
Status: Merged
Merged: 9/1/2023
Merged by: @mlsmaycon

Base: mainHead: fix/api_auth_with_useridclaim


📝 Commits (1)

  • 8cfc5e5 fix api auth with pat where userIDClaim creation for the downstream middleware is faked for some IdPs where userIDclaim is custom

📊 Changes

3 files changed (+19 additions, -12 deletions)

View changed files

📝 management/server/http/handler.go (+2 -1)
📝 management/server/http/middleware/auth_middleware.go (+7 -2)
📝 management/server/http/middleware/auth_middleware_test.go (+10 -9)

📄 Description

Describe your changes

The API authentication with PATs was not considering different userIDClaim that some of the IdPs are using.
In this PR we read the userIDClaim from the config file instead of using the fixed default and only keep it as a fallback if none in defined.

https://github.com/netbirdio/netbird/issues/1119

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • Extended the README / documentation, if necessary

🔄 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/netbirdio/netbird/pull/1120 **Author:** [@pascal-fischer](https://github.com/pascal-fischer) **Created:** 9/1/2023 **Status:** ✅ Merged **Merged:** 9/1/2023 **Merged by:** [@mlsmaycon](https://github.com/mlsmaycon) **Base:** `main` ← **Head:** `fix/api_auth_with_useridclaim` --- ### 📝 Commits (1) - [`8cfc5e5`](https://github.com/netbirdio/netbird/commit/8cfc5e56e1337025ab5f652b4f5a75b09399ac9e) fix api auth with pat where userIDClaim creation for the downstream middleware is faked for some IdPs where userIDclaim is custom ### 📊 Changes **3 files changed** (+19 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `management/server/http/handler.go` (+2 -1) 📝 `management/server/http/middleware/auth_middleware.go` (+7 -2) 📝 `management/server/http/middleware/auth_middleware_test.go` (+10 -9) </details> ### 📄 Description ## Describe your changes The API authentication with PATs was not considering different userIDClaim that some of the IdPs are using. In this PR we read the userIDClaim from the config file instead of using the fixed default and only keep it as a fallback if none in defined. ## Issue ticket number and link https://github.com/netbirdio/netbird/issues/1119 ### Checklist - [x] Is it a bug fix - [ ] Is a typo/documentation fix - [ ] Is a feature enhancement - [ ] It is a refactor - [ ] Created tests that fail without the change (if possible) - [ ] Extended the README / documentation, if necessary --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 03:06:32 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#14888