@@ -142,6 +142,8 @@ export const Settings = () => {
142
142
const [ groupsPropagationEnabled , setGroupsPropagationEnabled ] =
143
143
useState ( true ) ;
144
144
const [ jwtGroupsClaimName , setJwtGroupsClaimName ] = useState ( "" ) ;
145
+ const [ jwtAllowGroups , setJwtAllowGroups ] = useState < string [ ] > ( [ ] ) ;
146
+ const [ displayJWTAllowGroups , setDisplayJWTAllowGroups ] = useState ( false ) ;
145
147
const [ confirmModal , confirmModalContextHolder ] = Modal . useModal ( ) ;
146
148
const { confirm } = Modal ;
147
149
@@ -256,6 +258,7 @@ export const Settings = () => {
256
258
account . settings . peer_login_expiration_enabled ,
257
259
jwt_groups_enabled : account . settings . jwt_groups_enabled ,
258
260
jwt_groups_claim_name : account . settings . jwt_groups_claim_name ,
261
+ jwt_allow_groups : account . settings . jwt_allow_groups ? account . settings . jwt_allow_groups : [ ] ,
259
262
groups_propagation_enabled : account . settings . groups_propagation_enabled ,
260
263
peer_approval_enabled : account . settings . extra ? account . settings . extra . peer_approval_enabled : false ,
261
264
} as FormAccount ;
@@ -265,6 +268,7 @@ export const Settings = () => {
265
268
setJwtGroupsEnabled ( fAccount . jwt_groups_enabled ) ;
266
269
setGroupsPropagationEnabled ( fAccount . groups_propagation_enabled ) ;
267
270
setJwtGroupsClaimName ( fAccount . jwt_groups_claim_name ) ;
271
+ setJwtAllowGroups ( fAccount . jwt_allow_groups ) ;
268
272
form . setFieldsValue ( fAccount ) ;
269
273
} , [ accounts ] ) ;
270
274
@@ -430,6 +434,7 @@ export const Settings = () => {
430
434
jwt_groups_enabled : updatedAccount . data . settings . jwt_groups_enabled ,
431
435
jwt_groups_claim_name :
432
436
updatedAccount . data . settings . jwt_groups_claim_name ,
437
+ jwt_allow_groups : updatedAccount . data . settings . jwt_allow_groups ,
433
438
groups_propagation_enabled :
434
439
updatedAccount . data . settings . groups_propagation_enabled ,
435
440
peer_approval_enabled : updatedAccount . data . settings . extra ? updatedAccount . data . settings . extra . peer_approval_enabled : false ,
@@ -466,6 +471,7 @@ export const Settings = () => {
466
471
peer_login_expiration_enabled : formPeerExpirationEnabled ,
467
472
jwt_groups_enabled : jwtGroupsEnabled ,
468
473
jwt_groups_claim_name : jwtGroupsClaimName ,
474
+ jwt_allow_groups : jwtAllowGroups ,
469
475
groups_propagation_enabled : groupsPropagationEnabled ,
470
476
peer_approval_enabled : formPeerApprovalEnabled ,
471
477
} ) ;
@@ -495,6 +501,7 @@ export const Settings = () => {
495
501
peer_login_expiration_enabled : values . peer_login_expiration_enabled ,
496
502
jwt_groups_enabled : jwtGroupsEnabled ,
497
503
jwt_groups_claim_name : jwtGroupsClaimName ,
504
+ jwt_allow_groups : jwtAllowGroups ,
498
505
groups_propagation_enabled : groupsPropagationEnabled ,
499
506
} ,
500
507
} as Account ;
@@ -532,6 +539,7 @@ export const Settings = () => {
532
539
533
540
const saveAccount = ( newValues : FormAccount ) => {
534
541
let accountToSave = createAccountToSave ( newValues ) ;
542
+
535
543
dispatch (
536
544
accountActions . updateAccount . request ( {
537
545
getAccessTokenSilently : getTokenSilently ,
@@ -875,6 +883,56 @@ export const Settings = () => {
875
883
</ Form . Item >
876
884
</ Col >
877
885
</ Row >
886
+ < Row >
887
+ < Col span = { 12 } >
888
+ < label
889
+ style = { {
890
+ color : "rgba(0, 0, 0, 0.88)" ,
891
+ fontSize : "14px" ,
892
+ fontWeight : "500" ,
893
+ } }
894
+ >
895
+ JWT allow group
896
+ </ label >
897
+ < Paragraph
898
+ type = { "secondary" }
899
+ style = { {
900
+ marginTop : "-2" ,
901
+ fontWeight : "400" ,
902
+ marginBottom : "5px" ,
903
+ } }
904
+ >
905
+ Limit access to NetBird for the specified group name, e.g., NetBird users.
906
+ To use the group, first you need to configure it first in your IdP.
907
+ </ Paragraph >
908
+ </ Col >
909
+ </ Row >
910
+ < Row >
911
+ < Col lg = { 6 } >
912
+ < Form . Item name = "jwt_allow_groups" style = { displayJWTAllowGroups ? { marginBottom : "2px" , } : { } } >
913
+ < Input
914
+ value = { jwtAllowGroups [ 0 ] }
915
+ autoComplete = "off"
916
+ onChange = { ( e ) => {
917
+ setJwtAllowGroups ( [ e . target . value ] ) ;
918
+ setDisplayJWTAllowGroups ( true ) ;
919
+ } }
920
+ />
921
+ </ Form . Item >
922
+ </ Col >
923
+ </ Row >
924
+ { displayJWTAllowGroups && (
925
+ < Row >
926
+ < Paragraph style = { {
927
+ marginTop : "-20" ,
928
+ fontWeight : "400" ,
929
+ marginBottom : "5px" ,
930
+ color : "red"
931
+ } } >
932
+ To prevent losing access, ensure you are part of this group.
933
+ </ Paragraph >
934
+ </ Row >
935
+ ) }
878
936
</ >
879
937
) }
880
938
</ div >
0 commit comments