Commit 21eb59e
committed
feat(auth): add organization context to JWT tokens and secure organization switching
- Add CHANGE_SELECTED_ORGANIZATION permission to EMPLOYEE role
- Add PermissionGuard to /switch-organization endpoint
- Add organizationId to JWT access token payload
- Add organizationId to JWT refresh token payload
- Update getAccessTokenFromRefreshToken to maintain organization context
- Secure RequestContext.currentOrganizationId() to read from JWT instead of headers
BREAKING CHANGE: JWT tokens now include organizationId field. Clients should handle the new token structure.1 parent 38aa7d8 commit 21eb59e
File tree
4 files changed
+43
-11
lines changed- packages/core/src/lib
- auth
- core/context
- role-permission
4 files changed
+43
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
34 | | - | |
| 35 | + | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| |||
381 | 383 | | |
382 | 384 | | |
383 | 385 | | |
384 | | - | |
| 386 | + | |
| 387 | + | |
385 | 388 | | |
386 | 389 | | |
387 | 390 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
922 | 922 | | |
923 | 923 | | |
924 | 924 | | |
| 925 | + | |
925 | 926 | | |
926 | 927 | | |
927 | 928 | | |
| |||
945 | 946 | | |
946 | 947 | | |
947 | 948 | | |
| 949 | + | |
948 | 950 | | |
949 | 951 | | |
950 | 952 | | |
951 | | - | |
| 953 | + | |
952 | 954 | | |
953 | 955 | | |
954 | 956 | | |
955 | 957 | | |
956 | 958 | | |
957 | 959 | | |
958 | | - | |
| 960 | + | |
959 | 961 | | |
960 | 962 | | |
961 | 963 | | |
962 | 964 | | |
| 965 | + | |
963 | 966 | | |
964 | 967 | | |
965 | 968 | | |
| |||
975 | 978 | | |
976 | 979 | | |
977 | 980 | | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
978 | 984 | | |
979 | 985 | | |
980 | 986 | | |
| |||
985 | 991 | | |
986 | 992 | | |
987 | 993 | | |
988 | | - | |
989 | | - | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
990 | 1000 | | |
991 | 1001 | | |
992 | 1002 | | |
| |||
1686 | 1696 | | |
1687 | 1697 | | |
1688 | 1698 | | |
1689 | | - | |
| 1699 | + | |
1690 | 1700 | | |
1691 | 1701 | | |
1692 | 1702 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
| 197 | + | |
| 198 | + | |
198 | 199 | | |
199 | 200 | | |
200 | 201 | | |
201 | 202 | | |
202 | 203 | | |
203 | | - | |
204 | | - | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
205 | 223 | | |
206 | 224 | | |
207 | 225 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
489 | 489 | | |
490 | 490 | | |
491 | 491 | | |
| 492 | + | |
492 | 493 | | |
493 | 494 | | |
494 | 495 | | |
| |||
0 commit comments