@azure/msal-browser 3.5.0 → 3.5.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/IPublicClientApplication.d.ts +51 -51
- package/dist/app/IPublicClientApplication.mjs +102 -102
- package/dist/app/PublicClientApplication.d.ts +268 -268
- package/dist/app/PublicClientApplication.mjs +333 -333
- package/dist/app/PublicClientNext.d.ts +273 -273
- package/dist/app/PublicClientNext.mjs +351 -351
- package/dist/broker/nativeBroker/NativeMessageHandler.d.ts +62 -62
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs +254 -254
- package/dist/broker/nativeBroker/NativeRequest.d.ts +44 -44
- package/dist/broker/nativeBroker/NativeResponse.d.ts +48 -48
- package/dist/broker/nativeBroker/NativeStatusCodes.d.ts +7 -7
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs +11 -11
- package/dist/cache/AsyncMemoryStorage.d.ts +51 -51
- package/dist/cache/AsyncMemoryStorage.mjs +132 -132
- package/dist/cache/BrowserCacheManager.d.ts +383 -383
- package/dist/cache/BrowserCacheManager.mjs +1262 -1262
- package/dist/cache/BrowserStorage.d.ts +11 -11
- package/dist/cache/BrowserStorage.mjs +32 -32
- package/dist/cache/CryptoKeyStore.d.ts +18 -18
- package/dist/cache/CryptoKeyStore.mjs +40 -40
- package/dist/cache/DatabaseStorage.d.ts +56 -56
- package/dist/cache/DatabaseStorage.mjs +190 -190
- package/dist/cache/IAsyncMemoryStorage.d.ts +27 -27
- package/dist/cache/ITokenCache.d.ts +11 -11
- package/dist/cache/IWindowStorage.d.ts +27 -27
- package/dist/cache/MemoryStorage.d.ts +11 -11
- package/dist/cache/MemoryStorage.mjs +31 -31
- package/dist/cache/TokenCache.d.ts +77 -77
- package/dist/cache/TokenCache.mjs +224 -224
- package/dist/config/Configuration.d.ts +206 -206
- package/dist/config/Configuration.mjs +128 -128
- package/dist/controllers/ControllerFactory.d.ts +4 -4
- package/dist/controllers/ControllerFactory.mjs +29 -29
- package/dist/controllers/IController.d.ts +61 -61
- package/dist/controllers/NestedAppAuthController.d.ts +95 -95
- package/dist/controllers/NestedAppAuthController.d.ts.map +1 -1
- package/dist/controllers/NestedAppAuthController.mjs +335 -333
- package/dist/controllers/NestedAppAuthController.mjs.map +1 -1
- package/dist/controllers/StandardController.d.ts +407 -407
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/StandardController.mjs +1293 -1291
- package/dist/controllers/StandardController.mjs.map +1 -1
- package/dist/controllers/UnknownOperatingContextController.d.ts +87 -87
- package/dist/controllers/UnknownOperatingContextController.mjs +264 -264
- package/dist/crypto/BrowserCrypto.d.ts +44 -44
- package/dist/crypto/BrowserCrypto.mjs +93 -93
- package/dist/crypto/CryptoOps.d.ts +63 -63
- package/dist/crypto/CryptoOps.mjs +145 -145
- package/dist/crypto/PkceGenerator.d.ts +8 -8
- package/dist/crypto/PkceGenerator.mjs +54 -54
- package/dist/crypto/SignedHttpRequest.d.ts +30 -30
- package/dist/crypto/SignedHttpRequest.mjs +39 -39
- package/dist/encode/Base64Decode.d.ts +9 -9
- package/dist/encode/Base64Decode.mjs +36 -36
- package/dist/encode/Base64Encode.d.ts +19 -19
- package/dist/encode/Base64Encode.mjs +43 -43
- package/dist/error/BrowserAuthError.d.ts +250 -250
- package/dist/error/BrowserAuthError.mjs +258 -258
- package/dist/error/BrowserAuthErrorCodes.d.ts +45 -45
- package/dist/error/BrowserAuthErrorCodes.mjs +49 -49
- package/dist/error/BrowserConfigurationAuthError.d.ts +33 -33
- package/dist/error/BrowserConfigurationAuthError.mjs +40 -40
- package/dist/error/BrowserConfigurationAuthErrorCodes.d.ts +3 -3
- package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +7 -7
- package/dist/error/NativeAuthError.d.ts +29 -29
- package/dist/error/NativeAuthError.mjs +60 -60
- package/dist/error/NativeAuthErrorCodes.d.ts +2 -2
- package/dist/error/NativeAuthErrorCodes.mjs +6 -6
- package/dist/error/NestedAppAuthError.d.ts +14 -14
- package/dist/error/NestedAppAuthError.mjs +23 -23
- package/dist/event/EventHandler.d.ts +41 -41
- package/dist/event/EventHandler.mjs +119 -119
- package/dist/event/EventMessage.d.ts +25 -25
- package/dist/event/EventMessage.mjs +68 -68
- package/dist/event/EventType.d.ts +28 -28
- package/dist/event/EventType.mjs +31 -31
- package/dist/index.d.ts +39 -39
- package/dist/index.mjs +1 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts +54 -54
- package/dist/interaction_client/BaseInteractionClient.mjs +152 -152
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.d.ts +4 -4
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +10 -10
- package/dist/interaction_client/NativeInteractionClient.d.ts +140 -140
- package/dist/interaction_client/NativeInteractionClient.mjs +548 -548
- package/dist/interaction_client/PopupClient.d.ts +105 -105
- package/dist/interaction_client/PopupClient.mjs +432 -432
- package/dist/interaction_client/RedirectClient.d.ts +49 -49
- package/dist/interaction_client/RedirectClient.mjs +311 -311
- package/dist/interaction_client/SilentAuthCodeClient.d.ts +23 -23
- package/dist/interaction_client/SilentAuthCodeClient.mjs +57 -57
- package/dist/interaction_client/SilentCacheClient.d.ts +24 -24
- package/dist/interaction_client/SilentCacheClient.mjs +61 -61
- package/dist/interaction_client/SilentIframeClient.d.ts +32 -32
- package/dist/interaction_client/SilentIframeClient.mjs +96 -96
- package/dist/interaction_client/SilentRefreshClient.d.ts +20 -20
- package/dist/interaction_client/SilentRefreshClient.mjs +43 -43
- package/dist/interaction_client/StandardInteractionClient.d.ts +54 -54
- package/dist/interaction_client/StandardInteractionClient.mjs +222 -222
- package/dist/interaction_handler/InteractionHandler.d.ts +33 -33
- package/dist/interaction_handler/InteractionHandler.mjs +93 -93
- package/dist/interaction_handler/RedirectHandler.d.ts +32 -32
- package/dist/interaction_handler/RedirectHandler.mjs +134 -134
- package/dist/interaction_handler/SilentHandler.d.ts +13 -13
- package/dist/interaction_handler/SilentHandler.mjs +133 -133
- package/dist/naa/AccountInfo.d.ts +11 -12
- package/dist/naa/AccountInfo.d.ts.map +1 -1
- package/dist/naa/AccountRequests.d.ts +9 -9
- package/dist/naa/AuthBridge.d.ts +5 -5
- package/dist/naa/BridgeCapabilities.d.ts +3 -3
- package/dist/naa/BridgeError.d.ts +9 -9
- package/dist/naa/BridgeError.d.ts.map +1 -1
- package/dist/naa/BridgeError.mjs +7 -7
- package/dist/naa/BridgeError.mjs.map +1 -1
- package/dist/naa/BridgeProxy.d.ts +72 -71
- package/dist/naa/BridgeProxy.d.ts.map +1 -1
- package/dist/naa/BridgeProxy.mjs +152 -149
- package/dist/naa/BridgeProxy.mjs.map +1 -1
- package/dist/naa/BridgeRequest.d.ts +6 -6
- package/dist/naa/BridgeRequestEnvelope.d.ts +13 -13
- package/dist/naa/BridgeResponseEnvelope.d.ts +10 -10
- package/dist/naa/BridgeStatusCode.d.ts +10 -10
- package/dist/naa/BridgeStatusCode.mjs +15 -15
- package/dist/naa/IBridgeProxy.d.ts +12 -10
- package/dist/naa/IBridgeProxy.d.ts.map +1 -1
- package/dist/naa/InitializeBridgeResponse.d.ts +6 -6
- package/dist/naa/InitializeBridgeResponse.d.ts.map +1 -1
- package/dist/naa/TokenRequest.d.ts +19 -21
- package/dist/naa/TokenRequest.d.ts.map +1 -1
- package/dist/naa/TokenResponse.d.ts +15 -16
- package/dist/naa/TokenResponse.d.ts.map +1 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.d.ts +23 -25
- package/dist/naa/mapping/NestedAppAuthAdapter.d.ts.map +1 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs +142 -170
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs.map +1 -1
- package/dist/navigation/INavigationClient.d.ts +16 -16
- package/dist/navigation/NavigationClient.d.ts +22 -22
- package/dist/navigation/NavigationClient.mjs +40 -40
- package/dist/navigation/NavigationOptions.d.ts +12 -12
- package/dist/network/FetchClient.d.ts +26 -26
- package/dist/network/FetchClient.mjs +99 -99
- package/dist/operatingcontext/BaseOperatingContext.d.ts +40 -40
- package/dist/operatingcontext/BaseOperatingContext.mjs +44 -44
- package/dist/operatingcontext/StandardOperatingContext.d.ts +25 -25
- package/dist/operatingcontext/StandardOperatingContext.mjs +43 -43
- package/dist/operatingcontext/TeamsAppOperatingContext.d.ts +32 -32
- package/dist/operatingcontext/TeamsAppOperatingContext.d.ts.map +1 -1
- package/dist/operatingcontext/TeamsAppOperatingContext.mjs +85 -82
- package/dist/operatingcontext/TeamsAppOperatingContext.mjs.map +1 -1
- package/dist/operatingcontext/UnknownOperatingContext.d.ts +25 -25
- package/dist/operatingcontext/UnknownOperatingContext.mjs +42 -42
- package/dist/packageMetadata.d.ts +2 -2
- package/dist/packageMetadata.mjs +3 -3
- package/dist/request/AuthorizationCodeRequest.d.ts +8 -8
- package/dist/request/AuthorizationUrlRequest.d.ts +8 -8
- package/dist/request/ClearCacheRequest.d.ts +10 -10
- package/dist/request/EndSessionPopupRequest.d.ts +18 -18
- package/dist/request/EndSessionRequest.d.ts +15 -15
- package/dist/request/PopupRequest.d.ts +34 -34
- package/dist/request/PopupWindowAttributes.d.ts +15 -15
- package/dist/request/RedirectRequest.d.ts +35 -35
- package/dist/request/SilentRequest.d.ts +32 -32
- package/dist/request/SsoSilentRequest.d.ts +29 -29
- package/dist/response/AuthenticationResult.d.ts +4 -4
- package/dist/response/ResponseHandler.d.ts +7 -7
- package/dist/response/ResponseHandler.mjs +36 -36
- package/dist/telemetry/BrowserPerformanceClient.d.ts +36 -36
- package/dist/telemetry/BrowserPerformanceClient.mjs +125 -125
- package/dist/telemetry/BrowserPerformanceMeasurement.d.ts +21 -21
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs +92 -92
- package/dist/utils/BrowserConstants.d.ts +176 -176
- package/dist/utils/BrowserConstants.mjs +204 -204
- package/dist/utils/BrowserProtocolUtils.d.ts +11 -11
- package/dist/utils/BrowserProtocolUtils.mjs +21 -21
- package/dist/utils/BrowserUtils.d.ts +56 -56
- package/dist/utils/BrowserUtils.mjs +125 -125
- package/lib/msal-browser.cjs +17920 -17926
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +17920 -17926
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +59 -59
- package/package.json +102 -102
- package/src/controllers/NestedAppAuthController.ts +8 -3
- package/src/controllers/StandardController.ts +3 -1
- package/src/naa/AccountInfo.ts +3 -4
- package/src/naa/BridgeError.ts +4 -4
- package/src/naa/BridgeProxy.ts +6 -2
- package/src/naa/IBridgeProxy.ts +2 -0
- package/src/naa/InitializeBridgeResponse.ts +1 -1
- package/src/naa/TokenRequest.ts +0 -2
- package/src/naa/TokenResponse.ts +1 -2
- package/src/naa/mapping/NestedAppAuthAdapter.ts +72 -80
- package/src/operatingcontext/TeamsAppOperatingContext.ts +4 -1
package/package.json
CHANGED
|
@@ -1,105 +1,105 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
},
|
|
8
|
-
"license": "MIT",
|
|
9
|
-
"repository": {
|
|
10
|
-
"type": "git",
|
|
11
|
-
"url": "https://github.com/AzureAD/microsoft-authentication-library-for-js.git"
|
|
12
|
-
},
|
|
13
|
-
"version": "3.5.0",
|
|
14
|
-
"description": "Microsoft Authentication Library for js",
|
|
15
|
-
"keywords": [
|
|
16
|
-
"implicit",
|
|
17
|
-
"authorization code",
|
|
18
|
-
"PKCE",
|
|
19
|
-
"js",
|
|
20
|
-
"AAD",
|
|
21
|
-
"msal",
|
|
22
|
-
"oauth"
|
|
23
|
-
],
|
|
24
|
-
"type": "module",
|
|
25
|
-
"sideEffects": false,
|
|
26
|
-
"module": "./dist/index.mjs",
|
|
27
|
-
"types": "./dist/index.d.ts",
|
|
28
|
-
"exports": {
|
|
29
|
-
".": {
|
|
30
|
-
"types": "./dist/index.d.ts",
|
|
31
|
-
"module": "./dist/index.mjs",
|
|
32
|
-
"import": "./dist/index.mjs",
|
|
33
|
-
"require": "./lib/msal-browser.cjs",
|
|
34
|
-
"default": "./dist/index.mjs"
|
|
2
|
+
"name": "@azure/msal-browser",
|
|
3
|
+
"author": {
|
|
4
|
+
"name": "Microsoft",
|
|
5
|
+
"email": "nugetaad@microsoft.com",
|
|
6
|
+
"url": "https://www.microsoft.com"
|
|
35
7
|
},
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
"
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
"
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/AzureAD/microsoft-authentication-library-for-js.git"
|
|
12
|
+
},
|
|
13
|
+
"version": "3.5.1-beta.0",
|
|
14
|
+
"description": "Microsoft Authentication Library for js",
|
|
15
|
+
"keywords": [
|
|
16
|
+
"implicit",
|
|
17
|
+
"authorization code",
|
|
18
|
+
"PKCE",
|
|
19
|
+
"js",
|
|
20
|
+
"AAD",
|
|
21
|
+
"msal",
|
|
22
|
+
"oauth"
|
|
23
|
+
],
|
|
24
|
+
"type": "module",
|
|
25
|
+
"sideEffects": false,
|
|
26
|
+
"module": "./dist/index.mjs",
|
|
27
|
+
"types": "./dist/index.d.ts",
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"module": "./dist/index.mjs",
|
|
32
|
+
"import": "./dist/index.mjs",
|
|
33
|
+
"require": "./lib/msal-browser.cjs",
|
|
34
|
+
"default": "./dist/index.mjs"
|
|
35
|
+
},
|
|
36
|
+
"./package.json": "./package.json"
|
|
37
|
+
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=0.8.0"
|
|
40
|
+
},
|
|
41
|
+
"beachball": {
|
|
42
|
+
"disallowedChangeTypes": [
|
|
43
|
+
"major"
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
"directories": {
|
|
47
|
+
"test": "test"
|
|
48
|
+
},
|
|
49
|
+
"files": [
|
|
50
|
+
"dist",
|
|
51
|
+
"lib/msal-browser.js",
|
|
52
|
+
"lib/msal-browser.js.map",
|
|
53
|
+
"lib/msal-browser.cjs",
|
|
54
|
+
"lib/msal-browser.cjs.map",
|
|
55
|
+
"lib/msal-browser.min.js",
|
|
56
|
+
"src"
|
|
57
|
+
],
|
|
58
|
+
"scripts": {
|
|
59
|
+
"clean": "shx rm -rf dist lib",
|
|
60
|
+
"clean:coverage": "rimraf ../../.nyc_output/*",
|
|
61
|
+
"lint": "eslint src --ext .ts",
|
|
62
|
+
"lint:fix": "npm run lint -- --fix",
|
|
63
|
+
"test": "jest",
|
|
64
|
+
"test:coverage": "jest --coverage",
|
|
65
|
+
"test:coverage:only": "npm run clean:coverage && npm run test:coverage",
|
|
66
|
+
"build:all": "cd ../.. && npm run build --workspace=@azure/msal-common --workspace=@azure/msal-browser",
|
|
67
|
+
"build:modules": "rollup -c --strictDeprecations --bundleConfigAsCjs",
|
|
68
|
+
"build:modules:watch": "rollup -cw --bundleConfigAsCjs",
|
|
69
|
+
"build": "npm run clean && npm run build:modules",
|
|
70
|
+
"prepack": "npm run build:all",
|
|
71
|
+
"format:check": "npx prettier --ignore-path .gitignore --check src test",
|
|
72
|
+
"format:fix": "npx prettier --ignore-path .gitignore --write src test"
|
|
73
|
+
},
|
|
74
|
+
"devDependencies": {
|
|
75
|
+
"@azure/storage-blob": "^12.2.1",
|
|
76
|
+
"@babel/core": "^7.7.2",
|
|
77
|
+
"@babel/plugin-proposal-class-properties": "^7.7.0",
|
|
78
|
+
"@babel/plugin-proposal-object-rest-spread": "^7.6.2",
|
|
79
|
+
"@babel/preset-env": "^7.7.1",
|
|
80
|
+
"@babel/preset-typescript": "^7.7.2",
|
|
81
|
+
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
82
|
+
"@rollup/plugin-terser": "^0.4.0",
|
|
83
|
+
"@rollup/plugin-typescript": "^11.0.0",
|
|
84
|
+
"@types/jest": "^29.5.0",
|
|
85
|
+
"@types/node": "^20.3.1",
|
|
86
|
+
"@types/sinon": "^7.5.0",
|
|
87
|
+
"dotenv": "^8.2.0",
|
|
88
|
+
"eslint-config-msal": "^0.0.0",
|
|
89
|
+
"fake-indexeddb": "^3.1.3",
|
|
90
|
+
"jest": "^29.5.0",
|
|
91
|
+
"jest-environment-jsdom": "^29.5.0",
|
|
92
|
+
"prettier": "2.8.7",
|
|
93
|
+
"rimraf": "^3.0.0",
|
|
94
|
+
"rollup": "^3.14.0",
|
|
95
|
+
"shx": "^0.3.2",
|
|
96
|
+
"sinon": "^7.5.0",
|
|
97
|
+
"ssri": "^8.0.1",
|
|
98
|
+
"ts-jest": "^29.1.0",
|
|
99
|
+
"tslib": "^1.10.0",
|
|
100
|
+
"typescript": "^4.9.5"
|
|
101
|
+
},
|
|
102
|
+
"dependencies": {
|
|
103
|
+
"@azure/msal-common": "14.4.1-beta.0"
|
|
104
|
+
}
|
|
105
105
|
}
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
DEFAULT_CRYPTO_IMPLEMENTATION,
|
|
15
15
|
PerformanceEvents,
|
|
16
16
|
AccountFilter,
|
|
17
|
+
TimeUtils,
|
|
17
18
|
} from "@azure/msal-common";
|
|
18
19
|
import { ITokenCache } from "../cache/ITokenCache";
|
|
19
20
|
import { BrowserConfiguration } from "../config/Configuration";
|
|
@@ -134,13 +135,15 @@ export class NestedAppAuthController implements IController {
|
|
|
134
135
|
try {
|
|
135
136
|
const naaRequest =
|
|
136
137
|
this.nestedAppAuthAdapter.toNaaTokenRequest(request);
|
|
138
|
+
const reqTimestamp = TimeUtils.nowSeconds();
|
|
137
139
|
const response = await this.bridgeProxy.getTokenInteractive(
|
|
138
140
|
naaRequest
|
|
139
141
|
);
|
|
140
142
|
const result: AuthenticationResult =
|
|
141
143
|
this.nestedAppAuthAdapter.fromNaaTokenResponse(
|
|
142
144
|
naaRequest,
|
|
143
|
-
response
|
|
145
|
+
response,
|
|
146
|
+
reqTimestamp
|
|
144
147
|
);
|
|
145
148
|
|
|
146
149
|
this.operatingContext.setActiveAccount(result.account);
|
|
@@ -204,13 +207,15 @@ export class NestedAppAuthController implements IController {
|
|
|
204
207
|
|
|
205
208
|
try {
|
|
206
209
|
const naaRequest =
|
|
207
|
-
this.nestedAppAuthAdapter.
|
|
210
|
+
this.nestedAppAuthAdapter.toNaaTokenRequest(request);
|
|
211
|
+
const reqTimestamp = TimeUtils.nowSeconds();
|
|
208
212
|
const response = await this.bridgeProxy.getTokenSilent(naaRequest);
|
|
209
213
|
|
|
210
214
|
const result: AuthenticationResult =
|
|
211
215
|
this.nestedAppAuthAdapter.fromNaaTokenResponse(
|
|
212
216
|
naaRequest,
|
|
213
|
-
response
|
|
217
|
+
response,
|
|
218
|
+
reqTimestamp
|
|
214
219
|
);
|
|
215
220
|
|
|
216
221
|
this.operatingContext.setActiveAccount(result.account);
|
|
@@ -2088,7 +2088,9 @@ export class StandardController implements IController {
|
|
|
2088
2088
|
refreshTokenError.errorCode ===
|
|
2089
2089
|
ClientAuthErrorCodes.tokenRefreshRequired)) ||
|
|
2090
2090
|
refreshTokenError.errorCode ===
|
|
2091
|
-
InteractionRequiredAuthErrorCodes.noTokensFound
|
|
2091
|
+
InteractionRequiredAuthErrorCodes.noTokensFound ||
|
|
2092
|
+
refreshTokenError.errorCode ===
|
|
2093
|
+
InteractionRequiredAuthErrorCodes.refreshTokenExpired;
|
|
2092
2094
|
|
|
2093
2095
|
const tryIframeRenewal =
|
|
2094
2096
|
cacheLookupPolicy ===
|
package/src/naa/AccountInfo.ts
CHANGED
|
@@ -4,14 +4,13 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
export type AccountInfo = {
|
|
7
|
-
homeAccountId
|
|
7
|
+
homeAccountId?: string;
|
|
8
8
|
environment: string;
|
|
9
|
-
tenantId
|
|
9
|
+
tenantId?: string;
|
|
10
10
|
username: string;
|
|
11
|
-
localAccountId
|
|
11
|
+
localAccountId?: string;
|
|
12
12
|
name?: string;
|
|
13
13
|
idToken?: string; // idTokenClaims can be parsed from idToken in MSAL.js
|
|
14
14
|
platformBrokerId?: string; // Used by WAM previous called nativeAccountId
|
|
15
15
|
idTokenClaims?: object;
|
|
16
|
-
client_info?: string;
|
|
17
16
|
};
|
package/src/naa/BridgeError.ts
CHANGED
|
@@ -7,10 +7,10 @@ import { BridgeStatusCode } from "./BridgeStatusCode";
|
|
|
7
7
|
|
|
8
8
|
export type BridgeError = {
|
|
9
9
|
status: BridgeStatusCode;
|
|
10
|
-
code
|
|
11
|
-
subError
|
|
12
|
-
description
|
|
13
|
-
properties
|
|
10
|
+
code?: string; // auth_flow_last_error such as invalid_grant
|
|
11
|
+
subError?: string; // server_suberror_code such as consent_required
|
|
12
|
+
description?: string;
|
|
13
|
+
properties?: object; // additional telemetry info
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
export function isBridgeError(error: unknown): error is BridgeError {
|
package/src/naa/BridgeProxy.ts
CHANGED
|
@@ -36,7 +36,7 @@ export class BridgeProxy implements IBridgeProxy {
|
|
|
36
36
|
static crypto: Crypto;
|
|
37
37
|
sdkName: string;
|
|
38
38
|
sdkVersion: string;
|
|
39
|
-
capabilities
|
|
39
|
+
capabilities?: BridgeCapabilities;
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* initializeNestedAppAuthBridge - Initializes the bridge to the host app
|
|
@@ -162,6 +162,10 @@ export class BridgeProxy implements IBridgeProxy {
|
|
|
162
162
|
return this.sendRequest<AccountInfo>("GetActiveAccount", undefined);
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
+
public getHostCapabilities(): BridgeCapabilities | null {
|
|
166
|
+
return this.capabilities ?? null;
|
|
167
|
+
}
|
|
168
|
+
|
|
165
169
|
/**
|
|
166
170
|
* A method used to send a request to the bridge
|
|
167
171
|
* @param request A token request
|
|
@@ -206,7 +210,7 @@ export class BridgeProxy implements IBridgeProxy {
|
|
|
206
210
|
private constructor(
|
|
207
211
|
sdkName: string,
|
|
208
212
|
sdkVersion: string,
|
|
209
|
-
capabilities
|
|
213
|
+
capabilities?: BridgeCapabilities
|
|
210
214
|
) {
|
|
211
215
|
this.sdkName = sdkName;
|
|
212
216
|
this.sdkVersion = sdkVersion;
|
package/src/naa/IBridgeProxy.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
AccountByLocalIdRequest,
|
|
10
10
|
AccountByUsernameRequest,
|
|
11
11
|
} from "./AccountRequests";
|
|
12
|
+
import { BridgeCapabilities } from "./BridgeCapabilities";
|
|
12
13
|
import { TokenRequest } from "./TokenRequest";
|
|
13
14
|
import { TokenResponse } from "./TokenResponse";
|
|
14
15
|
|
|
@@ -22,4 +23,5 @@ export interface IBridgeProxy {
|
|
|
22
23
|
| AccountByUsernameRequest
|
|
23
24
|
): Promise<AccountInfo>;
|
|
24
25
|
getActiveAccount(): Promise<AccountInfo>;
|
|
26
|
+
getHostCapabilities(): BridgeCapabilities | null;
|
|
25
27
|
}
|
package/src/naa/TokenRequest.ts
CHANGED
|
@@ -9,7 +9,6 @@ export type TokenRequest = {
|
|
|
9
9
|
authority?: string;
|
|
10
10
|
scope: string;
|
|
11
11
|
correlationId: string;
|
|
12
|
-
prompt?: string; // Prompt used to identify interactive request
|
|
13
12
|
nonce?: string;
|
|
14
13
|
claims?: string;
|
|
15
14
|
state?: string;
|
|
@@ -18,7 +17,6 @@ export type TokenRequest = {
|
|
|
18
17
|
authenticationScheme?: string;
|
|
19
18
|
shrClaims?: string;
|
|
20
19
|
shrNonce?: string;
|
|
21
|
-
clientCapabilities?: string[]; // CP1 for CAE support
|
|
22
20
|
resourceRequestMethod?: string;
|
|
23
21
|
resourceRequestUri?: string;
|
|
24
22
|
extendedExpiryToken?: boolean;
|
package/src/naa/TokenResponse.ts
CHANGED
|
@@ -8,14 +8,13 @@ import { AccountInfo } from "./AccountInfo";
|
|
|
8
8
|
export type TokenResponse = {
|
|
9
9
|
access_token: string;
|
|
10
10
|
account: AccountInfo;
|
|
11
|
-
client_info: string;
|
|
12
11
|
expires_in: number;
|
|
13
12
|
id_token: string;
|
|
14
13
|
properties: TokenResponseProperties | null;
|
|
15
14
|
scope: string;
|
|
16
|
-
state: string;
|
|
17
15
|
shr?: string; // token binding enabled at native layer it is the access token, not the signing keys
|
|
18
16
|
extendedLifetimeToken?: boolean;
|
|
17
|
+
authority?: string;
|
|
19
18
|
};
|
|
20
19
|
|
|
21
20
|
export type TokenResponseProperties = {
|
|
@@ -15,16 +15,18 @@ import {
|
|
|
15
15
|
ClientConfigurationError,
|
|
16
16
|
InteractionRequiredAuthError,
|
|
17
17
|
ServerError,
|
|
18
|
-
TimeUtils,
|
|
19
18
|
ICrypto,
|
|
20
19
|
Logger,
|
|
21
20
|
AuthToken,
|
|
22
21
|
TokenClaims,
|
|
23
22
|
ClientAuthErrorCodes,
|
|
23
|
+
AuthenticationScheme,
|
|
24
|
+
RequestParameterBuilder,
|
|
25
|
+
StringUtils,
|
|
26
|
+
createClientAuthError,
|
|
24
27
|
} from "@azure/msal-common";
|
|
25
28
|
import { isBridgeError } from "../BridgeError";
|
|
26
29
|
import { BridgeStatusCode } from "../BridgeStatusCode";
|
|
27
|
-
import { SilentRequest } from "../../request/SilentRequest";
|
|
28
30
|
import { AuthenticationResult } from "../../response/AuthenticationResult";
|
|
29
31
|
import {} from "../../error/BrowserAuthErrorCodes";
|
|
30
32
|
|
|
@@ -46,41 +48,6 @@ export class NestedAppAuthAdapter {
|
|
|
46
48
|
this.logger = logger;
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
public toNaaSilentTokenRequest(request: SilentRequest): TokenRequest {
|
|
50
|
-
let extraParams: Map<string, string>;
|
|
51
|
-
if (request.extraQueryParameters === undefined) {
|
|
52
|
-
extraParams = new Map<string, string>();
|
|
53
|
-
} else {
|
|
54
|
-
extraParams = new Map<string, string>(
|
|
55
|
-
Object.entries(request.extraQueryParameters)
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Need to get information about the client to populate request correctly
|
|
60
|
-
* For example: client id, client capabilities
|
|
61
|
-
*/
|
|
62
|
-
const tokenRequest: TokenRequest = {
|
|
63
|
-
userObjectId: request.account?.homeAccountId,
|
|
64
|
-
clientId: this.clientId,
|
|
65
|
-
authority: request.authority,
|
|
66
|
-
scope: request.scopes.join(" "),
|
|
67
|
-
correlationId:
|
|
68
|
-
request.correlationId !== undefined
|
|
69
|
-
? request.correlationId
|
|
70
|
-
: this.crypto.createNewGuid(),
|
|
71
|
-
prompt: request.prompt !== undefined ? request.prompt : "",
|
|
72
|
-
claims: request.claims !== undefined ? request.claims : "",
|
|
73
|
-
authenticationScheme:
|
|
74
|
-
request.authenticationScheme !== undefined
|
|
75
|
-
? request.authenticationScheme
|
|
76
|
-
: "",
|
|
77
|
-
clientCapabilities: this.clientCapabilities,
|
|
78
|
-
extraParameters: extraParams,
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
return tokenRequest;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
51
|
public toNaaTokenRequest(
|
|
85
52
|
request: PopupRequest | RedirectRequest
|
|
86
53
|
): TokenRequest {
|
|
@@ -93,6 +60,11 @@ export class NestedAppAuthAdapter {
|
|
|
93
60
|
);
|
|
94
61
|
}
|
|
95
62
|
|
|
63
|
+
const requestBuilder = new RequestParameterBuilder();
|
|
64
|
+
const claims = requestBuilder.addClientCapabilitiesToClaims(
|
|
65
|
+
request.claims,
|
|
66
|
+
this.clientCapabilities
|
|
67
|
+
);
|
|
96
68
|
const tokenRequest: TokenRequest = {
|
|
97
69
|
userObjectId: request.account?.homeAccountId,
|
|
98
70
|
clientId: this.clientId,
|
|
@@ -101,16 +73,12 @@ export class NestedAppAuthAdapter {
|
|
|
101
73
|
correlationId:
|
|
102
74
|
request.correlationId !== undefined
|
|
103
75
|
? request.correlationId
|
|
104
|
-
:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
state: request.state !== undefined ? request.state : "",
|
|
76
|
+
: this.crypto.createNewGuid(),
|
|
77
|
+
nonce: request.nonce,
|
|
78
|
+
claims: !StringUtils.isEmptyObj(claims) ? claims : undefined,
|
|
79
|
+
state: request.state,
|
|
109
80
|
authenticationScheme:
|
|
110
|
-
request.authenticationScheme
|
|
111
|
-
? request.authenticationScheme
|
|
112
|
-
: "",
|
|
113
|
-
clientCapabilities: undefined,
|
|
81
|
+
request.authenticationScheme || AuthenticationScheme.BEARER,
|
|
114
82
|
extraParameters: extraParams,
|
|
115
83
|
};
|
|
116
84
|
|
|
@@ -119,36 +87,41 @@ export class NestedAppAuthAdapter {
|
|
|
119
87
|
|
|
120
88
|
public fromNaaTokenResponse(
|
|
121
89
|
request: TokenRequest,
|
|
122
|
-
response: TokenResponse
|
|
90
|
+
response: TokenResponse,
|
|
91
|
+
reqTimestamp: number
|
|
123
92
|
): AuthenticationResult {
|
|
93
|
+
if (!response.id_token || !response.access_token) {
|
|
94
|
+
throw createClientAuthError(ClientAuthErrorCodes.nullOrEmptyToken);
|
|
95
|
+
}
|
|
96
|
+
|
|
124
97
|
const expiresOn = new Date(
|
|
125
|
-
|
|
98
|
+
(reqTimestamp + (response.expires_in || 0)) * 1000
|
|
99
|
+
);
|
|
100
|
+
const idTokenClaims = AuthToken.extractTokenClaims(
|
|
101
|
+
response.id_token,
|
|
102
|
+
this.crypto.base64Decode
|
|
103
|
+
);
|
|
104
|
+
const account = this.fromNaaAccountInfo(
|
|
105
|
+
response.account,
|
|
106
|
+
idTokenClaims
|
|
126
107
|
);
|
|
127
|
-
|
|
128
|
-
const account = this.fromNaaAccountInfo(response.account);
|
|
129
108
|
|
|
130
109
|
const authenticationResult: AuthenticationResult = {
|
|
131
|
-
authority: response.account.environment,
|
|
132
|
-
uniqueId:
|
|
133
|
-
tenantId:
|
|
110
|
+
authority: response.authority || account.environment,
|
|
111
|
+
uniqueId: account.localAccountId,
|
|
112
|
+
tenantId: account.tenantId,
|
|
134
113
|
scopes: response.scope.split(" "),
|
|
135
|
-
account
|
|
114
|
+
account,
|
|
136
115
|
idToken: response.id_token !== undefined ? response.id_token : "",
|
|
137
|
-
idTokenClaims
|
|
138
|
-
account.idTokenClaims !== undefined
|
|
139
|
-
? account.idTokenClaims
|
|
140
|
-
: {},
|
|
116
|
+
idTokenClaims,
|
|
141
117
|
accessToken: response.access_token,
|
|
142
118
|
fromCache: true,
|
|
143
119
|
expiresOn: expiresOn,
|
|
144
120
|
tokenType:
|
|
145
|
-
request.authenticationScheme
|
|
146
|
-
? request.authenticationScheme
|
|
147
|
-
: "Bearer",
|
|
121
|
+
request.authenticationScheme || AuthenticationScheme.BEARER,
|
|
148
122
|
correlationId: request.correlationId,
|
|
149
|
-
requestId: "",
|
|
150
123
|
extExpiresOn: expiresOn,
|
|
151
|
-
state:
|
|
124
|
+
state: request.state,
|
|
152
125
|
};
|
|
153
126
|
|
|
154
127
|
return authenticationResult;
|
|
@@ -176,26 +149,41 @@ export class NestedAppAuthAdapter {
|
|
|
176
149
|
* authorityType?: string;
|
|
177
150
|
* };
|
|
178
151
|
*/
|
|
179
|
-
public fromNaaAccountInfo(
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
152
|
+
public fromNaaAccountInfo(
|
|
153
|
+
fromAccount: NaaAccountInfo,
|
|
154
|
+
idTokenClaims?: TokenClaims
|
|
155
|
+
): MsalAccountInfo {
|
|
156
|
+
const effectiveIdTokenClaims =
|
|
157
|
+
idTokenClaims || (fromAccount.idTokenClaims as TokenClaims);
|
|
158
|
+
|
|
159
|
+
const localAccountId =
|
|
160
|
+
fromAccount.localAccountId ||
|
|
161
|
+
effectiveIdTokenClaims?.oid ||
|
|
162
|
+
effectiveIdTokenClaims?.sub ||
|
|
163
|
+
"";
|
|
164
|
+
|
|
165
|
+
const tenantId =
|
|
166
|
+
fromAccount.tenantId || effectiveIdTokenClaims?.tid || "";
|
|
167
|
+
|
|
168
|
+
const homeAccountId =
|
|
169
|
+
fromAccount.homeAccountId || `${localAccountId}.${tenantId}`;
|
|
170
|
+
|
|
171
|
+
const username =
|
|
172
|
+
fromAccount.username ||
|
|
173
|
+
effectiveIdTokenClaims?.preferred_username ||
|
|
174
|
+
"";
|
|
175
|
+
|
|
176
|
+
const name = fromAccount.name || effectiveIdTokenClaims?.name;
|
|
189
177
|
|
|
190
178
|
const account: MsalAccountInfo = {
|
|
191
|
-
homeAccountId
|
|
179
|
+
homeAccountId,
|
|
192
180
|
environment: fromAccount.environment,
|
|
193
|
-
tenantId
|
|
194
|
-
username
|
|
195
|
-
localAccountId
|
|
196
|
-
name
|
|
181
|
+
tenantId,
|
|
182
|
+
username,
|
|
183
|
+
localAccountId,
|
|
184
|
+
name,
|
|
197
185
|
idToken: fromAccount.idToken,
|
|
198
|
-
idTokenClaims:
|
|
186
|
+
idTokenClaims: effectiveIdTokenClaims,
|
|
199
187
|
};
|
|
200
188
|
|
|
201
189
|
return account;
|
|
@@ -233,7 +221,11 @@ export class NestedAppAuthAdapter {
|
|
|
233
221
|
ClientAuthErrorCodes.nestedAppAuthBridgeDisabled
|
|
234
222
|
);
|
|
235
223
|
case BridgeStatusCode.NESTED_APP_AUTH_UNAVAILABLE:
|
|
236
|
-
return new ClientAuthError(
|
|
224
|
+
return new ClientAuthError(
|
|
225
|
+
error.code ||
|
|
226
|
+
ClientAuthErrorCodes.nestedAppAuthBridgeDisabled,
|
|
227
|
+
error.description
|
|
228
|
+
);
|
|
237
229
|
case BridgeStatusCode.TRANSIENT_ERROR:
|
|
238
230
|
case BridgeStatusCode.PERSISTENT_ERROR:
|
|
239
231
|
return new ServerError(error.code, error.description);
|
|
@@ -70,7 +70,10 @@ export class TeamsAppOperatingContext extends BaseOperatingContext {
|
|
|
70
70
|
* this.activeAccount = await bridgeProxy.getActiveAccount();
|
|
71
71
|
*/
|
|
72
72
|
try {
|
|
73
|
-
|
|
73
|
+
if (bridgeProxy.getHostCapabilities()?.queryAccount) {
|
|
74
|
+
this.activeAccount =
|
|
75
|
+
await bridgeProxy.getActiveAccount();
|
|
76
|
+
}
|
|
74
77
|
} catch (e) {
|
|
75
78
|
this.activeAccount = undefined;
|
|
76
79
|
}
|