[PR #1368] Enable JWT group-based user authorization #3093

Open
opened 2025-11-20 08:04:56 -05:00 by saavagebueno · 0 comments
Owner

Original Pull Request: https://github.com/netbirdio/netbird/pull/1368

State: closed
Merged: Yes


Describe your changes

  • Extend the update account endpoint /api/accounts/{accountId} to accommodate the introduction of a new optional field, jwt_allow_groups. This field enables the specification of groups whose members are permitted access to Netbird when utilizing JWT Group Propagation.
curl -X PUT http://localhost:33073/api/accounts/<ACCOUNT_ID> \
-H 'Accept: application/json' \
-H 'Authorization: Token <PAT>' \
-d '{
	"settings": {
		"groups_propagation_enabled": true,
		"jwt_allow_groups": [
			"NetBird", "Admins"
		],
		"jwt_groups_claim_name": "groups",
		"jwt_groups_enabled": true,
		"peer_login_expiration": 86400,
		"peer_login_expiration_enabled": true
	}
}'

  • Add user group-based authorization. This implementation checks for JWT group propagation and jwt_allow_groups settings. Users attempting authentication without membership in the specified group list will have their authentication rejected. Additionally, if no allow groups are set, all users will be authenticated seamlessly.

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
**Original Pull Request:** https://github.com/netbirdio/netbird/pull/1368 **State:** closed **Merged:** Yes --- ## Describe your changes - Extend the update account endpoint /api/accounts/{accountId} to accommodate the introduction of a new optional field, jwt_allow_groups. This field enables the specification of groups whose members are permitted access to Netbird when utilizing JWT Group Propagation. ``` curl -X PUT http://localhost:33073/api/accounts/<ACCOUNT_ID> \ -H 'Accept: application/json' \ -H 'Authorization: Token <PAT>' \ -d '{ "settings": { "groups_propagation_enabled": true, "jwt_allow_groups": [ "NetBird", "Admins" ], "jwt_groups_claim_name": "groups", "jwt_groups_enabled": true, "peer_login_expiration": 86400, "peer_login_expiration_enabled": true } }' ``` - Add user group-based authorization. This implementation checks for JWT group propagation and jwt_allow_groups settings. Users attempting authentication without membership in the specified group list will have their authentication rejected. Additionally, if no allow groups are set, all users will be authenticated seamlessly. ## Issue ticket number and link - #1194 ### 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
saavagebueno added the pull-request label 2025-11-20 08:04:56 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/netbird#3093