Commit d2a975a
authored
Use MSA accounts in a different app registration in development mode. (#646)
This pull request updates authentication to use Microsoft Entra ID
tokens (idTokens) instead of accessTokens for both client and server,
ensuring compatibility with consumer accounts and improving token
validation logic. It also updates the registered application client ID
and authority settings to match the new configuration.
After this change, the default dev environment authentication is to the
consumer/MSA endpoint with a consumer app registration. This hardens the
security on our default app registration (which will be deleted).
**Authentication and Token Handling Updates:**
* All API requests now use the idToken (JWT format) for authentication
instead of the accessToken, which resolves issues with token formats for
Microsoft consumer accounts.
(`workbench-app/src/libs/useWorkbenchEventSource.ts`,
`workbench-app/src/libs/useWorkbenchService.ts`,
`workbench-app/src/services/workbench/workbench.ts`)
[[1]](diffhunk://#diff-3d3ca6faf36d3f8d4143834ae316a63eb29e2ca2082b88bf0997a1015b85a436L28)
[[2]](diffhunk://#diff-3d3ca6faf36d3f8d4143834ae316a63eb29e2ca2082b88bf0997a1015b85a436L37-R36)
[[3]](diffhunk://#diff-b6586258227965fe312b1145d4a557ab4ad6621ee44e9326d3b78771d0396899L72-R77)
[[4]](diffhunk://#diff-b6586258227965fe312b1145d4a557ab4ad6621ee44e9326d3b78771d0396899L92-R100)
[[5]](diffhunk://#diff-b6586258227965fe312b1145d4a557ab4ad6621ee44e9326d3b78771d0396899L117-R113)
[[6]](diffhunk://#diff-e75ed6685ae471ab4f7e79cf2cc4e6a59fad835f034dfd440b7966c01bb299b9L53-R54)
* Server-side token validation logic now correctly handles both Entra ID
and Microsoft Account tokens by supporting multiple claims (`appid`,
`aud`, `azp`) and user identification via either `tid.oid` or `sub`.
(`workbench-service/semantic_workbench_service/middleware.py`)
[[1]](diffhunk://#diff-194bc52316f6142f7c72dc398fda0b96db610aa43867b8e919c20b45255dbe5eL88-R104)
[[2]](diffhunk://#diff-194bc52316f6142f7c72dc398fda0b96db610aa43867b8e919c20b45255dbe5eL104-R122)
**Configuration Changes:**
* Updated the client ID and authority in both the example environment
file and code to use the new Semantic Workbench Consumer app
registration and point to the consumer authority.
(`workbench-app/.env.example`, `workbench-app/src/Constants.ts`,
`workbench-service/semantic_workbench_service/config.py`)
[[1]](diffhunk://#diff-af053f8fbc99393eb60448226ac141bbcc0b8c3b5baa51aa5662a681e46cd2aaL7-R15)
[[2]](diffhunk://#diff-af053f8fbc99393eb60448226ac141bbcc0b8c3b5baa51aa5662a681e46cd2aaL26-R26)
[[3]](diffhunk://#diff-b526f45bc05cd865e965d6d4b0701b8c7f7ad229c5599fcb602733431ea975f7L65-R77)
[[4]](diffhunk://#diff-d0fe0c2d539cfe17b626c2c5510efac730af5e1c2fa0984a638a352ea06cbf27L28-R28)
**Code Quality Improvements:**
* Improved type imports for Awaitable and Callable to use
`collections.abc` for better compatibility and clarity.
(`workbench-service/semantic_workbench_service/middleware.py`)1 parent 0ba22e7 commit d2a975a
File tree
9 files changed
+58
-77
lines changed- libraries/python/openai-client/tests
- workbench-app
- src
- libs
- services/workbench
- workbench-service
- semantic_workbench_service
- tests
9 files changed
+58
-77
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
16 | 28 | | |
17 | 29 | | |
18 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
| 77 | + | |
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
| |||
34 | 33 | | |
35 | 34 | | |
36 | 35 | | |
37 | | - | |
38 | | - | |
| 36 | + | |
39 | 37 | | |
40 | 38 | | |
41 | 39 | | |
| |||
85 | 83 | | |
86 | 84 | | |
87 | 85 | | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | 86 | | |
116 | 87 | | |
117 | 88 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | 24 | | |
48 | 25 | | |
49 | 26 | | |
| |||
69 | 46 | | |
70 | 47 | | |
71 | 48 | | |
72 | | - | |
73 | 49 | | |
74 | 50 | | |
75 | 51 | | |
76 | 52 | | |
77 | 53 | | |
78 | | - | |
79 | | - | |
| 54 | + | |
80 | 55 | | |
81 | 56 | | |
82 | 57 | | |
| |||
89 | 64 | | |
90 | 65 | | |
91 | 66 | | |
92 | | - | |
| 67 | + | |
93 | 68 | | |
94 | 69 | | |
95 | 70 | | |
96 | 71 | | |
97 | | - | |
98 | 72 | | |
99 | 73 | | |
100 | 74 | | |
101 | 75 | | |
102 | 76 | | |
103 | | - | |
104 | | - | |
| 77 | + | |
105 | 78 | | |
106 | 79 | | |
107 | 80 | | |
| |||
114 | 87 | | |
115 | 88 | | |
116 | 89 | | |
117 | | - | |
| 90 | + | |
118 | 91 | | |
119 | 92 | | |
120 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
| 53 | + | |
| 54 | + | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
Lines changed: 22 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | | - | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
88 | | - | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
89 | 92 | | |
90 | 93 | | |
| 94 | + | |
91 | 95 | | |
92 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
93 | 105 | | |
94 | 106 | | |
95 | 107 | | |
| |||
101 | 113 | | |
102 | 114 | | |
103 | 115 | | |
104 | | - | |
105 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
106 | 123 | | |
107 | 124 | | |
108 | 125 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
44 | 46 | | |
45 | 47 | | |
46 | 48 | | |
| 49 | + | |
| 50 | + | |
47 | 51 | | |
48 | 52 | | |
49 | 53 | | |
| 54 | + | |
| 55 | + | |
50 | 56 | | |
51 | 57 | | |
52 | 58 | | |
| |||
59 | 65 | | |
60 | 66 | | |
61 | 67 | | |
62 | | - | |
| 68 | + | |
63 | 69 | | |
64 | 70 | | |
65 | 71 | | |
| |||
0 commit comments