[PR #305] [MERGED] Adding peer registration support to JWT #12442

Closed
opened 2026-08-05 02:05:55 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/305
Author: @mlsmaycon
Created: 5/4/2022
Status: Merged
Merged: 5/5/2022
Merged by: @mlsmaycon

Base: mainHead: ui-sso-login


📝 Commits (10+)

  • 347b3a8 Split token validation
  • cd51d4b Split Extract logic to standalone
  • 7986ae0 Add JWT token field to login request
  • 98f6b1b Login with JWT token
  • 8bb370b Add JWT token field
  • c78f42e Add JWT token field support
  • c750ce1 Add SSO login to connect button
  • 2fd0686 Merge branch 'main' into ui-sso-login
  • dc0fc16 Update daemon proto with JWTToken field
  • e8740e5 add jwtToken variable

📊 Changes

24 files changed (+427 additions, -248 deletions)

View changed files

📝 client/cmd/login.go (+1 -1)
📝 client/cmd/root.go (+1 -0)
📝 client/cmd/up.go (+1 -1)
📝 client/internal/engine_test.go (+1 -1)
📝 client/internal/login.go (+7 -7)
📝 client/proto/daemon.pb.go (+56 -45)
📝 client/proto/daemon.proto (+3 -0)
📝 client/server/server.go (+2 -2)
📝 management/client/client.go (+1 -1)
📝 management/client/client_test.go (+4 -4)
📝 management/client/grpc.go (+2 -2)
📝 management/client/mock.go (+3 -3)
📝 management/proto/management.pb.go (+130 -119)
📝 management/proto/management.proto (+2 -0)
📝 management/proto/management_grpc.pb.go (+4 -0)
📝 management/server/account.go (+2 -7)
📝 management/server/account_test.go (+71 -2)
📝 management/server/config.go (+10 -0)
📝 management/server/grpcserver.go (+51 -7)
📝 management/server/http/middleware/jwtmiddleware.go (+35 -25)

...and 4 more files

📄 Description

Clients can send JWT as part of the Login message.

  • The management will validate the JWT as it does in the API and will register the Peer to the user's account.
  • New fields were added to grpc messages in management and client daemon and its clients were updated
  • Peer has one new field, UserID, that will hold the id of the user that registered it
  • JWT middleware CheckJWT got splitter and renamed to support validation for non HTTP requests
  • Added test for adding new Peer with UserID
  • Lots of tests update because of new field

🔄 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/305 **Author:** [@mlsmaycon](https://github.com/mlsmaycon) **Created:** 5/4/2022 **Status:** ✅ Merged **Merged:** 5/5/2022 **Merged by:** [@mlsmaycon](https://github.com/mlsmaycon) **Base:** `main` ← **Head:** `ui-sso-login` --- ### 📝 Commits (10+) - [`347b3a8`](https://github.com/netbirdio/netbird/commit/347b3a8a249726d1b054b4c5f991e87dc4429667) Split token validation - [`cd51d4b`](https://github.com/netbirdio/netbird/commit/cd51d4bfe0dd13076b55458fd1fd4482e3558017) Split Extract logic to standalone - [`7986ae0`](https://github.com/netbirdio/netbird/commit/7986ae0bf4726b738e252a629a5ad5785cdaadcd) Add JWT token field to login request - [`98f6b1b`](https://github.com/netbirdio/netbird/commit/98f6b1bbf33ea14780ac41e179036ce62be9c295) Login with JWT token - [`8bb370b`](https://github.com/netbirdio/netbird/commit/8bb370b29526c19212206cb775b8135aa97faf41) Add JWT token field - [`c78f42e`](https://github.com/netbirdio/netbird/commit/c78f42ef110ac6e9444bd84693d5e80648210fff) Add JWT token field support - [`c750ce1`](https://github.com/netbirdio/netbird/commit/c750ce138b3a3e8a9632c38fb3f65fef41d89c1f) Add SSO login to connect button - [`2fd0686`](https://github.com/netbirdio/netbird/commit/2fd068633c97a8885b64c6c90c50a015bf135886) Merge branch 'main' into ui-sso-login - [`dc0fc16`](https://github.com/netbirdio/netbird/commit/dc0fc16678855238f8b5e9972e5d8042bc756bd1) Update daemon proto with JWTToken field - [`e8740e5`](https://github.com/netbirdio/netbird/commit/e8740e532788157f141b95a1f640dcdd50fbc6b9) add jwtToken variable ### 📊 Changes **24 files changed** (+427 additions, -248 deletions) <details> <summary>View changed files</summary> 📝 `client/cmd/login.go` (+1 -1) 📝 `client/cmd/root.go` (+1 -0) 📝 `client/cmd/up.go` (+1 -1) 📝 `client/internal/engine_test.go` (+1 -1) 📝 `client/internal/login.go` (+7 -7) 📝 `client/proto/daemon.pb.go` (+56 -45) 📝 `client/proto/daemon.proto` (+3 -0) 📝 `client/server/server.go` (+2 -2) 📝 `management/client/client.go` (+1 -1) 📝 `management/client/client_test.go` (+4 -4) 📝 `management/client/grpc.go` (+2 -2) 📝 `management/client/mock.go` (+3 -3) 📝 `management/proto/management.pb.go` (+130 -119) 📝 `management/proto/management.proto` (+2 -0) 📝 `management/proto/management_grpc.pb.go` (+4 -0) 📝 `management/server/account.go` (+2 -7) 📝 `management/server/account_test.go` (+71 -2) 📝 `management/server/config.go` (+10 -0) 📝 `management/server/grpcserver.go` (+51 -7) 📝 `management/server/http/middleware/jwtmiddleware.go` (+35 -25) _...and 4 more files_ </details> ### 📄 Description Clients can send JWT as part of the Login message. * The management will validate the JWT as it does in the API and will register the Peer to the user's account. * New fields were added to grpc messages in management and client daemon and its clients were updated * Peer has one new field, UserID, that will hold the id of the user that registered it * JWT middleware CheckJWT got splitter and renamed to support validation for non HTTP requests * Added test for adding new Peer with UserID * Lots of tests update because of new field --- <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 02:05:55 -04:00
saavagebueno changed title from [PR #305] [MERGED] Adding peer registration support to JWT to [PR #305] Adding peer registration support to JWT 2026-08-05 02:08:19 -04:00
saavagebueno changed title from [PR #305] Adding peer registration support to JWT to [PR #305] [MERGED] Adding peer registration support to JWT 2026-08-05 03:06:03 -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#12442