Commit af12874
[TeamsDevices] [nGMS] Add DeviceCodeFlow (DCF) to Broker (#1752)
### **What**
This PR includes adding DCF to Broker for Teams Devices' nGMS changes.
Feature is controlled by `FlightNames.ENABLE_NGMS_FLOW` and is currently
set to false.
### **Why** and **How**
nGMS Teams Devices Design PR:
https://identitydivision.visualstudio.com/DevEx/_git/AuthLibrariesApiReview/pullrequest/6564?_a=files
// TODO:
1) Add Telemetry once Msal to Broker telemetry is setup. Currently, I've
added OTel spans for broker side
2) Add UTs
### **Testing and Validation:**
Tested DCF` authResult ` flow and able to get the User code and other
DCF info successfully

Tested DCF `acquireToken` by signing into `/devicelogin` and able to get
token successfully

Validated that an exception shall be thrown if nGMS Feature flag
(FlightNames.ENABLE_NGMS_FLOW)
is disabled

---------
Co-authored-by: REDMOND\amritsaini <[email protected]>1 parent 68ccf78 commit af12874
File tree
11 files changed
+722
-9
lines changed- msal/src
- main/java/com/microsoft/identity/client
- internal
- test/java/com/microsoft/identity/client
- e2e
- shadows
- tests/mocked
11 files changed
+722
-9
lines changed- changelog.txt+3
- common/build.gradle+2
- common/src/main/java/com/microsoft/identity/common/adal/internal/AuthenticationConstants.java+24-1
- common/src/main/java/com/microsoft/identity/common/internal/broker/BrokerData.java-120
- common/src/main/java/com/microsoft/identity/common/internal/broker/BrokerData.kt+107
- common/src/main/java/com/microsoft/identity/common/internal/broker/BrokerValidator.java+5-8
- common/src/main/java/com/microsoft/identity/common/internal/broker/ipc/BrokerOperationBundle.java+3-1
- common/src/main/java/com/microsoft/identity/common/internal/cache/ActiveBrokerCache.kt+140
- common/src/main/java/com/microsoft/identity/common/internal/cache/IActiveBrokerCache.kt+52
- common/src/main/java/com/microsoft/identity/common/internal/commands/DeviceCodeFlowCommand.java-110
- common/src/main/java/com/microsoft/identity/common/internal/controllers/BrokerMsalController.java+125-12
- common/src/main/java/com/microsoft/identity/common/internal/controllers/LocalMSALController.java+2-48
- common/src/main/java/com/microsoft/identity/common/internal/request/IBrokerRequestAdapter.java+2-3
- common/src/main/java/com/microsoft/identity/common/internal/request/MsalBrokerRequestAdapter.java+92-4
- common/src/main/java/com/microsoft/identity/common/internal/result/MsalBrokerResultAdapter.java+82-1
- common/src/main/java/com/microsoft/identity/common/internal/util/ProcessUtil.java+1-1
- common/src/test/java/com/microsoft/identity/common/internal/BrokerValidatorTests.java+6-6
- common/src/test/java/com/microsoft/identity/common/internal/cache/ActiveBrokerCacheTest.kt+295
- common4j/src/main/com/microsoft/identity/common/java/AuthenticationConstants.java+5
- common4j/src/main/com/microsoft/identity/common/java/commands/DeviceCodeFlowAuthResultCommand.java+118
- common4j/src/main/com/microsoft/identity/common/java/commands/DeviceCodeFlowCommand.java+151
- common4j/src/main/com/microsoft/identity/common/java/commands/DeviceCodeFlowCommandCallback.java+3-5
- common4j/src/main/com/microsoft/identity/common/java/commands/DeviceCodeFlowTokenResultCommand.java+120
- common4j/src/main/com/microsoft/identity/common/java/commands/parameters/BrokerDeviceCodeFlowCommandParameters.java+90
- common4j/src/main/com/microsoft/identity/common/java/commands/parameters/DeviceCodeFlowCommandParameters.java-2
- common4j/src/main/com/microsoft/identity/common/java/commands/parameters/TokenCommandParameters.java+16
- common4j/src/main/com/microsoft/identity/common/java/controllers/BaseController.java+46-8
- common4j/src/main/com/microsoft/identity/common/java/controllers/CommandDispatcher.java+91-8
- common4j/src/main/com/microsoft/identity/common/java/eststelemetry/PublicApiId.java+1
- common4j/src/main/com/microsoft/identity/common/java/exception/ArgumentException.java+1
- common4j/src/main/com/microsoft/identity/common/java/exception/ErrorStrings.java+6
- common4j/src/main/com/microsoft/identity/common/java/exception/IrrecoverableDcfException.java+30
- common4j/src/main/com/microsoft/identity/common/java/marker/PerfConstants.java+5
- common4j/src/main/com/microsoft/identity/common/java/net/UrlConnectionHttpClient.java+29
- common4j/src/main/com/microsoft/identity/common/java/opentelemetry/AttributeName.java+18-5
- common4j/src/main/com/microsoft/identity/common/java/opentelemetry/SpanName.java+6-1
- common4j/src/main/com/microsoft/identity/common/java/providers/microsoft/MicrosoftTokenResponse.java+25
Lines changed: 43 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| 37 | + | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
| |||
89 | 92 | | |
90 | 93 | | |
91 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
92 | 110 | | |
93 | 111 | | |
94 | 112 | | |
| |||
Lines changed: 46 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
86 | | - | |
87 | 85 | | |
88 | 86 | | |
89 | 87 | | |
| |||
100 | 98 | | |
101 | 99 | | |
102 | 100 | | |
| 101 | + | |
| 102 | + | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| 139 | + | |
139 | 140 | | |
140 | 141 | | |
141 | 142 | | |
| |||
1838 | 1839 | | |
1839 | 1840 | | |
1840 | 1841 | | |
| 1842 | + | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + | |
| 1847 | + | |
| 1848 | + | |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
| 1856 | + | |
| 1857 | + | |
| 1858 | + | |
| 1859 | + | |
| 1860 | + | |
| 1861 | + | |
| 1862 | + | |
| 1863 | + | |
| 1864 | + | |
| 1865 | + | |
| 1866 | + | |
| 1867 | + | |
| 1868 | + | |
| 1869 | + | |
| 1870 | + | |
| 1871 | + | |
| 1872 | + | |
| 1873 | + | |
| 1874 | + | |
| 1875 | + | |
| 1876 | + | |
| 1877 | + | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
| 1883 | + | |
| 1884 | + | |
1841 | 1885 | | |
1842 | 1886 | | |
1843 | 1887 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | 62 | | |
64 | 63 | | |
65 | 64 | | |
66 | 65 | | |
67 | 66 | | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
Lines changed: 41 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
203 | 204 | | |
204 | 205 | | |
205 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
206 | 247 | | |
207 | 248 | | |
208 | 249 | | |
| |||
Lines changed: 74 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| 39 | + | |
38 | 40 | | |
39 | 41 | | |
40 | 42 | | |
| |||
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
| 55 | + | |
53 | 56 | | |
54 | 57 | | |
55 | 58 | | |
| |||
146 | 149 | | |
147 | 150 | | |
148 | 151 | | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
149 | 176 | | |
150 | 177 | | |
151 | 178 | | |
| |||
232 | 259 | | |
233 | 260 | | |
234 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
235 | 309 | | |
236 | 310 | | |
237 | 311 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | | - | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
| 27 | + | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | | - | |
28 | | - | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
0 commit comments