[PR #1012] [MERGED] Add PKCE authorization flow #13223

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

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/1012
Author: @bcmmbaga
Created: 7/13/2023
Status: Merged
Merged: 7/27/2023
Merged by: @mlsmaycon

Base: mainHead: feature/add-pkce-authorization-flow-config


📝 Commits (8)

  • fcb313c add PKCE authorization flow config
  • 21063e4 fix docker compose linux test
  • ac2c964 add AUTH_PREFIX for PKCE env and enable the use of ID token for PKCE
  • e7674de Add PKCE authorization flow service in management and client (#1013)
  • 56879cf Merge branch 'main' into feature/add-pkce-authorization-flow-config
  • c63477e add pkce flow timeout
  • a563ebc resolved issue with example port exceeding the maximum allowed port number
  • db18d3d check for pkce SSO support

📊 Changes

27 files changed (+1395 additions, -581 deletions)

View changed files

📝 .github/workflows/test-docker-compose-linux.yml (+9 -2)
📝 client/android/login.go (+16 -23)
📝 client/cmd/login.go (+11 -24)
client/internal/auth/device_flow.go (+202 -0)
📝 client/internal/auth/device_flow_test.go (+16 -15)
client/internal/auth/oauth.go (+90 -0)
client/internal/auth/pkce_flow.go (+217 -0)
client/internal/auth/util.go (+62 -0)
📝 client/internal/device_auth.go (+6 -6)
client/internal/oauth.go (+0 -286)
client/internal/pkce_auth.go (+128 -0)
📝 client/server/server.go (+20 -32)
📝 infrastructure_files/base.setup.env (+7 -1)
📝 infrastructure_files/configure.sh (+13 -0)
📝 infrastructure_files/management.json.tmpl (+12 -0)
📝 infrastructure_files/setup.env.example (+6 -0)
📝 management/client/client.go (+1 -0)
📝 management/client/client_test.go (+46 -0)
📝 management/client/grpc.go (+34 -0)
📝 management/client/mock.go (+8 -0)

...and 7 more files

📄 Description

Describe your changes

Enhance the user experience by enabling authentication to Netbird using Single Sign-On (SSO) with any Identity Provider (IDP) provider. Current client offers this capability through the Device Authorization Flow, however, is not widely supported by many IDPs, and even some that do support it do not provide a complete verification URL.

To address these challenges, this pull request enable Authorization Code Flow with Proof Key for Code Exchange (PKCE) for client logins, which is a more widely adopted and secure approach to facilitate SSO with various IDP providers.

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/1012 **Author:** [@bcmmbaga](https://github.com/bcmmbaga) **Created:** 7/13/2023 **Status:** ✅ Merged **Merged:** 7/27/2023 **Merged by:** [@mlsmaycon](https://github.com/mlsmaycon) **Base:** `main` ← **Head:** `feature/add-pkce-authorization-flow-config` --- ### 📝 Commits (8) - [`fcb313c`](https://github.com/netbirdio/netbird/commit/fcb313c557f8840c97217f7ff6207fa19eade075) add PKCE authorization flow config - [`21063e4`](https://github.com/netbirdio/netbird/commit/21063e4f90443da6c1ceab613b11e379179f8c2a) fix docker compose linux test - [`ac2c964`](https://github.com/netbirdio/netbird/commit/ac2c964d246bcdb9ece71ff5424cf4d3d83ca31e) add AUTH_PREFIX for PKCE env and enable the use of ID token for PKCE - [`e7674de`](https://github.com/netbirdio/netbird/commit/e7674de1d2a68edbf698353cd4966b6e189aca12) Add PKCE authorization flow service in management and client (#1013) - [`56879cf`](https://github.com/netbirdio/netbird/commit/56879cf3e743564d8acf43fc72d50aab01d17e87) Merge branch 'main' into feature/add-pkce-authorization-flow-config - [`c63477e`](https://github.com/netbirdio/netbird/commit/c63477e609fbf1e9bf2a41fa8910c02c18d3318c) add pkce flow timeout - [`a563ebc`](https://github.com/netbirdio/netbird/commit/a563ebc2471326bdc6530e3d8efcbb3097d36be7) resolved issue with example port exceeding the maximum allowed port number - [`db18d3d`](https://github.com/netbirdio/netbird/commit/db18d3d4178195ff349fcdb99163a2d3dfe2f3c0) check for pkce SSO support ### 📊 Changes **27 files changed** (+1395 additions, -581 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/test-docker-compose-linux.yml` (+9 -2) 📝 `client/android/login.go` (+16 -23) 📝 `client/cmd/login.go` (+11 -24) ➕ `client/internal/auth/device_flow.go` (+202 -0) 📝 `client/internal/auth/device_flow_test.go` (+16 -15) ➕ `client/internal/auth/oauth.go` (+90 -0) ➕ `client/internal/auth/pkce_flow.go` (+217 -0) ➕ `client/internal/auth/util.go` (+62 -0) 📝 `client/internal/device_auth.go` (+6 -6) ➖ `client/internal/oauth.go` (+0 -286) ➕ `client/internal/pkce_auth.go` (+128 -0) 📝 `client/server/server.go` (+20 -32) 📝 `infrastructure_files/base.setup.env` (+7 -1) 📝 `infrastructure_files/configure.sh` (+13 -0) 📝 `infrastructure_files/management.json.tmpl` (+12 -0) 📝 `infrastructure_files/setup.env.example` (+6 -0) 📝 `management/client/client.go` (+1 -0) 📝 `management/client/client_test.go` (+46 -0) 📝 `management/client/grpc.go` (+34 -0) 📝 `management/client/mock.go` (+8 -0) _...and 7 more files_ </details> ### 📄 Description ## Describe your changes Enhance the user experience by enabling authentication to Netbird using Single Sign-On (SSO) with any Identity Provider (IDP) provider. Current client offers this capability through the Device Authorization Flow, however, is not widely supported by many IDPs, and even some that do support it do not provide a complete verification URL. To address these challenges, this pull request enable Authorization Code Flow with Proof Key for Code Exchange (PKCE) for client logins, which is a more widely adopted and secure approach to facilitate SSO with various IDP providers. ## Issue ticket number and link ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [x] 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 02:07:48 -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#13223