Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
87ef692
feat: add WAM DPoP broker contract fields
hectormmg Aug 17, 2026
e50f088
feat: support DPoP in DOM broker path
hectormmg Aug 20, 2026
264bee6
fix: surface broker DPoP proof
hectormmg Aug 24, 2026
8416e99
feat: add WAM DPoP broker contract fields
hectormmg Aug 17, 2026
2764a1b
feat: support DPoP in DOM broker path
hectormmg Aug 20, 2026
7488f09
fix: surface broker DPoP proof
hectormmg Aug 24, 2026
20e4b35
chore: add broker DPoP changefile
hectormmg Aug 24, 2026
939daaf
Merge WI-1 into WI-2
hectormmg Aug 24, 2026
05f56ee
feat(msal-browser): support brokered DPoP outcomes
hectormmg Aug 25, 2026
a9e5140
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
hectormmg Aug 25, 2026
d6a5410
feat: add WAM DPoP broker contract fields
hectormmg Aug 17, 2026
364af35
feat: support DPoP in DOM broker path
hectormmg Aug 20, 2026
25ef782
fix: surface broker DPoP proof
hectormmg Aug 24, 2026
99f5786
chore: add broker DPoP changefile
hectormmg Aug 24, 2026
c286dd3
fix: harden broker DPoP outcome handling
hectormmg Aug 25, 2026
3a99059
Merge updated WI-1 DPoP broker contracts
hectormmg Aug 25, 2026
651c5b9
chore: format merged broker DPoP tests
hectormmg Aug 25, 2026
1051c35
fix: finish broker DPoP validation fixes
hectormmg Aug 26, 2026
5f5281e
fix: address test failures (Forge review-fix)
hectormmg Aug 26, 2026
8897fd2
fix: address review findings (Forge review-fix)
hectormmg Aug 26, 2026
e67cadb
fix: address review findings (Forge review-fix)
hectormmg Aug 26, 2026
08f25fd
chore: restore DPoP changefile ownership metadata
hectormmg Aug 26, 2026
3bd5271
fix: address review findings (Forge review-fix)
hectormmg Aug 26, 2026
4f3e853
fix: address test failures (Forge review-fix)
hectormmg Aug 26, 2026
6f2dcf7
fix: address review findings (Forge review-fix)
hectormmg Aug 26, 2026
e3f8637
fix: finalize DPoP review corrections
hectormmg Aug 26, 2026
b0ee3c5
fix: address review findings (Forge review-fix)
hectormmg Aug 26, 2026
82a58e8
fix: address review findings (Forge review-fix)
hectormmg Aug 26, 2026
b10669e
fix: address review findings (Forge review-fix)
hectormmg Aug 26, 2026
9bb8291
chore: restore platform broker DPoP changefile PR
hectormmg Aug 27, 2026
e3301bc
revert: remove review-driven DPoP scope expansion
hectormmg Aug 28, 2026
1e7255d
fix(msal-browser): enforce MSAL-owned DPoP keys
hectormmg Sep 1, 2026
8802707
fix: map DOM request confirmation
hectormmg Sep 2, 2026
c9abd7d
feat: add WAM DPoP broker contract fields
hectormmg Aug 17, 2026
7b5ff4a
feat: support DPoP in DOM broker path
hectormmg Aug 20, 2026
83797f1
fix: surface broker DPoP proof
hectormmg Aug 24, 2026
0644bea
chore: add broker DPoP changefile
hectormmg Aug 24, 2026
c981fdf
fix: map DOM request confirmation
hectormmg Sep 2, 2026
0ed82fc
Merge branch 'copilot/ab-3715427-wam-dpop-contract-types' of https://…
hectormmg Sep 2, 2026
b12464f
merge: update WI-2 from refreshed WI-1
hectormmg Sep 2, 2026
293aa92
refactor(msal-browser): identify token binding schemes declaratively
hectormmg Sep 2, 2026
0cd6982
merge: inherit declarative token binding helper from WI-1
hectormmg Sep 2, 2026
509f5c6
fix(msal-browser): correct broker DPoP reqCnf
hectormmg Sep 2, 2026
6c540a8
fix: address review findings (Forge review-fix)
hectormmg Sep 2, 2026
26d50ae
fix: address review findings (Forge review-fix)
hectormmg Sep 2, 2026
fcdd77d
fix: address review findings (Forge review-fix)
hectormmg Sep 3, 2026
14550f8
Merge dev broker contract into WI-2
hectormmg Sep 16, 2026
41b7eca
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
hectormmg Sep 17, 2026
bfbab14
fix: harden DPoP broker key lifecycle
hectormmg Oct 2, 2026
ba45830
Merge origin/dev into DPoP broker branch
hectormmg Oct 5, 2026
55b9c85
chore: reduce DPoP review churn
hectormmg Oct 5, 2026
4ace81d
refactor: simplify broker DPoP cleanup
hectormmg Oct 5, 2026
d34dbe6
Harden broker DPoP outcome handling
hectormmg Oct 6, 2026
2ba4b54
Document DPoP cache replacement failure semantics
hectormmg Oct 6, 2026
c6a237f
Ignore caller DPoP keys on direct broker requests
hectormmg Oct 7, 2026
6fc4dc9
Merge origin/dev into DPoP broker outcome branch
hectormmg Oct 7, 2026
43332eb
Fix broker DPoP request and key lifecycle
hectormmg Oct 12, 2026
8dbb168
Defer platform DOM DPoP outcome handling
hectormmg Oct 13, 2026
c93ef02
Document DPoP production readiness
hectormmg Oct 14, 2026
18e4265
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
hectormmg Oct 14, 2026
3e6f3cf
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
hectormmg Oct 14, 2026
00374b5
Use public DPoP binding terminology
hectormmg Oct 14, 2026
e323515
Clarify public DPoP binding terminology
hectormmg Oct 14, 2026
46a6b61
Focus broker DPoP docs on app behavior
hectormmg Oct 14, 2026
945922c
Classify unsupported DOM DPoP requests
hectormmg Oct 14, 2026
550d7c2
Remove obsolete DPoP proof alias
hectormmg Oct 15, 2026
396ca1a
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
hectormmg Oct 15, 2026
53d45ce
Align extension proof test with L3 outcome
hectormmg Oct 15, 2026
181d9ce
Persist redirect broker error telemetry
hectormmg Oct 15, 2026
5e61a56
Add bounded broker DPoP outcome telemetry
hectormmg Oct 15, 2026
255d12d
Test emitted broker DPoP telemetry
hectormmg Oct 15, 2026
3516324
Clarify redirect broker error handling
hectormmg Oct 18, 2026
71d9d62
Keep temporary DPoP errors internal
hectormmg Oct 18, 2026
334780f
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
hectormmg Oct 18, 2026
389dacd
Remove internal DPoP nonce parameter bridge
hectormmg Oct 19, 2026
350c1f8
Clear sign-out state when native cleanup fails
hectormmg Oct 19, 2026
2756817
Scope redirect key persistence to DPoP
hectormmg Oct 19, 2026
f67042b
Document broker DPoP helper types
hectormmg Oct 19, 2026
c15fb2d
Document DPoP redirect key persistence
hectormmg Oct 19, 2026
5fa08ee
Handle broker responses without telemetry properties
hectormmg Oct 19, 2026
1af785c
Clarify DPoP redirect storage requirements
hectormmg Oct 19, 2026
76457c8
Add broker DPoP lifecycle telemetry
hectormmg Oct 19, 2026
3847f0b
Qualify IndexedDB fallback documentation
hectormmg Oct 19, 2026
eeeb243
Clarify broker DPoP redirect navigation
hectormmg Oct 19, 2026
8258a7d
Organize platform broker DPoP guidance
hectormmg Oct 19, 2026
864d60f
Clarify broker DPoP preview availability
hectormmg Oct 19, 2026
7c3d69f
Remove redundant broker DPoP changes
hectormmg Oct 19, 2026
0682ffe
Preserve synchronous popup logout
hectormmg Oct 19, 2026
d5878ec
Restore scoped platform broker request handling
hectormmg Oct 20, 2026
cb3a631
Avoid duplicate native account cleanup
hectormmg Oct 20, 2026
43f004c
Clarify platform broker DPoP helpers
hectormmg Oct 20, 2026
886c26f
Restore original platform SKU documentation
hectormmg Oct 20, 2026
fd5f515
Clarify DPoP key cleanup behavior
hectormmg Oct 20, 2026
2dd8b9d
Clarify broker result token type selection
hectormmg Oct 20, 2026
8812ef4
Align broker DPoP response properties
hectormmg Oct 20, 2026
9b932ba
Decompose broker DPoP outcome validation
hectormmg Oct 20, 2026
a49fb88
Avoid mutating broker DPoP responses
hectormmg Oct 20, 2026
b9f4d16
Enforce string DPoP attestation values
hectormmg Oct 20, 2026
8f80ec5
Clarify broker DPoP outcome dispatch
hectormmg Oct 20, 2026
6958324
Merge branch 'dev' of https://github.com/AzureAD/microsoft-authentica…
hectormmg Oct 20, 2026
5b299d0
Preserve token binding manager for EAR
hectormmg Oct 20, 2026
1c587ac
Move broker DPoP response types
hectormmg Oct 22, 2026
5c0e2d7
Merge remote-tracking branch 'origin/dev' into copilot/ab-3715428-wam…
hectormmg Oct 22, 2026
97284ab
Fix broker DPoP ownership and concurrency
hectormmg Oct 28, 2026
d5b3c83
Merge origin/dev into WI-2 DPoP branch
hectormmg Oct 28, 2026
0658f27
Refactor broker cache binding parameters
hectormmg Oct 29, 2026
4be324b
Merge branch 'dev' into copilot/ab-3715428-wam-dpop-outcome-handling
hectormmg Oct 29, 2026
85588b3
Merge branch 'dev' into copilot/ab-3715428-wam-dpop-outcome-handling
hectormmg Oct 30, 2026
b14d729
Merge branch 'dev' into copilot/ab-3715428-wam-dpop-outcome-handling
hectormmg Oct 30, 2026
461c396
Merge branch 'dev' into copilot/ab-3715428-wam-dpop-outcome-handling
hectormmg Nov 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions change/@azure-msal-browser-wam-dpop-outcomes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Implement extension-only WAM DPoP routing outcomes, MSAL-managed request keys, and proof cache policy [#8789](https://github.com/AzureAD/microsoft-authentication-library-for-js/pull/8789)",
"packageName": "@azure/msal-browser",
"email": "hectormmg@microsoft.com",
"dependentChangeType": "minor"
}
7 changes: 7 additions & 0 deletions change/@azure-msal-common-browser-dpop-proof-export.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Export the DPoP proof generator from the browser entry point [#8789](https://github.com/AzureAD/microsoft-authentication-library-for-js/pull/8789)",
"packageName": "@azure/msal-common",
"email": "hectormmg@microsoft.com",
"dependentChangeType": "minor"
}
8 changes: 8 additions & 0 deletions docs/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,14 @@ msalInstance.acquireTokenSilent(); // This will also no longer throw this error

- Invalid PoP token request. The request should not have both a popKid value and signPopToken set to true.

### `dpop_pop_kid_not_supported`

- For DPoP requests routed through the platform broker, application-supplied `popKid` values are not supported. MSAL provisions and manages the DPoP key for these requests.

### `platform_auth_dom_dpop_not_supported`

- An internal DPoP request reached the Platform Authentication DOM API, which does not support DPoP. MSAL normally routes these requests through the browser-managed DPoP flow instead.

### `unsupported_token_binding_algorithm`

- The token-binding key algorithm is not supported by the browser crypto implementation.
Expand Down
5 changes: 3 additions & 2 deletions lib/msal-browser/docs/browser-compat-map.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This document catalogs browser Web APIs that MSAL Browser depends on, their role
|-----|-----------|----------|
| `sessionStorage` | Interaction status, PKCE verifier, redirect origin URL, redirect bridge response cache | `MemoryStorage` (response lost on navigation) |
| `localStorage` | Persistent token cache (when `cacheLocation: "localStorage"`) | None if configured; not used by default |
| `IndexedDB` | PoP token RSA keypairs and DPoP token-binding keypairs | In-memory (keys lost on reload) |
| `IndexedDB` | PoP token RSA keypairs and DPoP token-binding keypairs | In-memory for same-page flows when the storage failure is reported as unavailable; none when an MSAL-owned key must survive redirect navigation |
| `document.cookie` | Encryption key for localStorage cache | None — cache cannot be decrypted without it |

**MSAL-specific restrictions:**
Expand Down Expand Up @@ -136,7 +136,7 @@ After MSAL selects the DOM provider, a token-request failure is surfaced through
|-----|:-:|:-:|:-:|:-:|:-:|:-:|
| `sessionStorage` | ✅ | | | | | |
| `localStorage` | ○ | ○ | ○ | ○ | | |
| `IndexedDB` | ○ | ○ | ○ | ○ | | |
| `IndexedDB` | ○⁵ | ○ | ○ | ○ | | ○⁵ |
| `BroadcastChannel` | ¹ | ✅ | ✅ | ✅² | | |
| Same-origin location polling (`system.enableLegacyPolling`) | ○ | | ○ | ○ | | |
| `window.open()` | | ✅ | | | | |
Expand All @@ -153,4 +153,5 @@ After MSAL selects the DOM provider, a token-request failure is surfaced through
- ² when refresh token expired and MSAL falls back to hidden iframe
- ³ IdP session cookie required in iframe; MSAL's own cookie for localStorage encryption only
- ⁴ optional DOM-based platform-broker provider; requires both configuration flags and the `get-token-and-sign-out` contract
- ⁵ required for web DPoP redirect and platform-broker L1 redirect when an MSAL-owned key must survive navigation; broker-provided L3 proofs do not require cross-navigation key persistence
- Legacy polling is opt-in for popup responses, silent iframe responses, and popup logout; it requires the passive same-origin callback and a popup reference that remains connected for the full round-trip
36 changes: 36 additions & 0 deletions lib/msal-browser/docs/device-bound-tokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,42 @@ There are a few things that may behave a little differently when acquiring token
- If the platform broker needs to prompt the user for interaction a system prompt will be opened. This prompt looks a bit different from the browser popup windows you may be used to.
- Switching your account in the platform broker prompt is not supported and MSAL.js will throw an error (Error Code: user_switch) if this happens. It is your app's responsibility to catch this error and handle it in a way that makes sense for your scenarios (e.g. Show an error page, retry with the new account, retry with the original account, etc.)

### DPoP with the platform broker

> [!WARNING]
> Although MSAL Browser contains the client implementation, end-to-end platform-broker DPoP is not generally available today.
>
> It requires all of the following:
>
> - A Windows build with broker DPoP support. Such builds are not currently available through public Windows releases.
> - A Microsoft Entra-joined device configured for platform-broker authentication.
> - The Windows Accounts extension.
> - Server-side DPoP support and enablement in the Microsoft Entra token service and target resource.
>
> Unless your environment has been explicitly enabled for a coordinated preview, treat platform-broker DPoP as unavailable and do not depend on it for production use. APIs and behavior may change.

#### Availability and provider selection

Within an explicitly enabled preview environment, DPoP broker support is available only through the Windows Accounts extension. When the Platform Authentication DOM API provider is active, MSAL uses the browser-managed DPoP flow instead. Applications use the same DPoP request and response handling in either case; no broker-specific configuration is required.

#### Broker binding outcomes

Through the Windows Accounts extension, MSAL asks the platform broker to use broker-attested binding as a best-effort security improvement. With an L1 outcome, the token is bound to an MSAL-generated browser key and MSAL creates the resource proof locally. With an L3 outcome, the platform broker supplies the resource proof. Token issuance and Conditional Access determine whether the available binding satisfies tenant policy; applications receive and use the resulting DPoP token in the same way regardless of the binding mechanism.

MSAL rejects invalid or inconsistent broker responses instead of returning an unbound token. Application-managed DPoP keys are not supported through the Windows Accounts extension.

#### Redirect key persistence

When `acquireTokenRedirect()` uses the Windows Accounts extension, broker interaction occurs while the current application page remains loaded. If the broker returns an L1 outcome, MSAL must retain its generated key across the subsequent application-page navigation used to resume the request through `handleRedirectPromise()`. MSAL therefore verifies that the key is available in [IndexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API) before performing that navigation and fails the request if it was not persisted. If the broker returns an L3 outcome, the broker supplies the DPoP proof, so MSAL discards the local candidate key and does not require it to survive the application-page navigation.

#### Request requirements and limitations

DPoP requests must include the resource method and URI used to build the proof.

Resource-server DPoP nonce forwarding is not yet supported through the Windows Accounts extension. Applications must not pass `pop_nonce` through `extraParameters`; nonce support will use a dedicated API and internal nonce store.

For the complete request shape and proof usage, see [DPoP for PublicClientApplication](./access-token-proof-of-possession.md#dpop-for-publicclientapplication).

## Acquiring Device Bound Tokens using DOM API

MSAL.js also supports acquiring tokens from the platform broker using DOM APIs in Edge. Instead of using a browser extension to communicate with the platform broker, MSAL.js can directly call a DOM API in the Edge browser, which in turn invokes the platform broker to acquire tokens.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
import {
DOMExtraParameters,
PlatformAuthRequest,
PlatformAuthTokenType,
PlatformDOMTokenRequest,
} from "./PlatformAuthRequest.js";
import { PlatformAuthConstants } from "../../utils/BrowserConstants.js";
Expand All @@ -23,9 +24,13 @@ import {
PlatformDOMTokenResponse,
} from "./PlatformAuthResponse.js";
import { createNativeAuthError } from "../../error/NativeAuthError.js";
import { createBrowserAuthError } from "../../error/BrowserAuthError.js";
import { IPlatformAuthHandler } from "./IPlatformAuthHandler.js";
import * as BrowserPerformanceEvents from "../../telemetry/BrowserPerformanceEvents.js";

const PLATFORM_AUTH_DOM_DPOP_NOT_SUPPORTED =
"platform_auth_dom_dpop_not_supported";

export class PlatformAuthDOMHandler implements IPlatformAuthHandler {
protected logger: Logger;
protected performanceClient: IPerformanceClient;
Expand Down Expand Up @@ -169,6 +174,15 @@ export class PlatformAuthDOMHandler implements IPlatformAuthHandler {
);

try {
if (
request.tokenType?.trim().toLowerCase() ===
PlatformAuthTokenType.DPOP_WITH_PROOF
) {
throw createBrowserAuthError(
PLATFORM_AUTH_DOM_DPOP_NOT_SUPPORTED,
correlationId
);
}
const platformDOMRequest = invoke(
this.initializePlatformDOMRequest.bind(this),
BrowserPerformanceEvents.PlatformAuthDOMInitializeRequest,
Expand Down Expand Up @@ -231,6 +245,7 @@ export class PlatformAuthDOMHandler implements IPlatformAuthHandler {
);
delete remainingProperties.resourceRequestMethod;
delete remainingProperties.resourceRequestUri;
delete remainingProperties.bindingPreferenceSent;

const validExtraParameters: DOMExtraParameters = this.getDOMExtraParams(
remainingProperties,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export class PlatformAuthExtensionHandler implements IPlatformAuthHandler {
const extensionRequest = { ...request };
delete extensionRequest.resourceRequestMethod;
delete extensionRequest.resourceRequestUri;
delete extensionRequest.bindingPreferenceSent;
const messageBody: NativeExtensionRequestBody = {
method: NativeExtensionMethod.GetToken,
request: extensionRequest,
Expand All @@ -119,15 +120,9 @@ export class PlatformAuthExtensionHandler implements IPlatformAuthHandler {
`'${this.platformAuthType}' - Sending request to browser extension`,
correlationId
);
this.logger.tracePii(
Comment thread
lalimasharda marked this conversation as resolved.
Resolved
`'${
this.platformAuthType
}' - Sending request to browser extension: '${JSON.stringify(
req
)}'`,
correlationId
);
this.messageChannel.port1.postMessage(req);
request.bindingPreferenceSent =
extensionRequest.preferBinding !== undefined;

const response: object = await new Promise((resolve, reject) => {
this.resolvers.set(req.responseId, {
Expand Down Expand Up @@ -410,14 +405,6 @@ export class PlatformAuthExtensionHandler implements IPlatformAuthHandler {
`'${this.platformAuthType}' - Received response from browser extension`,
correlationId
);
this.logger.tracePii(
Comment thread
lalimasharda marked this conversation as resolved.
Resolved
`'${
this.platformAuthType
}' - Received response from browser extension: '${JSON.stringify(
response
)}'`,
correlationId
);
if (response.status !== "Success") {
resolver.reject(
createNativeAuthError(
Expand All @@ -428,10 +415,7 @@ export class PlatformAuthExtensionHandler implements IPlatformAuthHandler {
)
);
} else if (response.result) {
if (
response.result["code"] &&
response.result["description"]
) {
if (response.result["code"]) {
resolver.reject(
createNativeAuthError(
response.result["code"],
Expand Down Expand Up @@ -559,11 +543,12 @@ export class PlatformAuthExtensionHandler implements IPlatformAuthHandler {
Object.prototype.hasOwnProperty.call(response, "scope") &&
Object.prototype.hasOwnProperty.call(response, "expires_in")
) {
const validatedResponse = response as PlatformAuthResponse;
validationMeasurement.end({
success: true,
platformAuthProviderType: this.platformAuthType,
});
return response as PlatformAuthResponse;
return validatedResponse;
} else {
const error = createAuthError(
AuthErrorCodes.unexpectedError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ export function isPlatformAuthAllowed(
const schemeSupported =
!authenticationScheme ||
authenticationScheme === Constants.AuthenticationScheme.BEARER ||
authenticationScheme === Constants.AuthenticationScheme.POP;
authenticationScheme === Constants.AuthenticationScheme.POP ||
(authenticationScheme === Constants.AuthenticationScheme.DPOP &&
!(platformAuthProvider instanceof PlatformAuthDOMHandler));
const fields = {
allowPlatformBroker: config.system.allowPlatformBroker,
...(config.system.allowPlatformBroker && {
Expand Down
20 changes: 12 additions & 8 deletions lib/msal-browser/src/broker/nativeBroker/PlatformAuthRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ export type PlatformAuthRequest = {
enclave?: PlatformAuthEnclave;
reqCnf?: string;
keyId?: string;
/**
* Records whether a binding preference was included on the broker wire.
* This is internal response-validation state and must not be sent.
*/
bindingPreferenceSent?: boolean;
tokenType?: PlatformAuthTokenType;
shrClaims?: string;
shrNonce?: string;
Expand All @@ -123,27 +128,26 @@ export type PlatformAuthRequest = {
* Adds canonical proof request fields to the broker no-cache property bag.
*/
export function createPlatformAuthExtraParametersNoCache(
extraParametersNoCache: PlatformAuthExtraParametersNoCache | undefined,
isProofOfPossessionRequest: boolean,
tokenType: PlatformAuthTokenType | undefined,
resourceRequestMethod?: string,
resourceRequestUri?: string,
dpopNonce?: string
): PlatformAuthExtraParametersNoCache | undefined {
if (!isProofOfPossessionRequest) {
return extraParametersNoCache;
if (!isProofOfPossessionTokenType(tokenType)) {
return undefined;
}

return {
...extraParametersNoCache,
...(resourceRequestMethod && {
pop_method: resourceRequestMethod,
}),
...(resourceRequestUri && {
pop_url: resourceRequestUri,
}),
...(dpopNonce && {
pop_nonce: dpopNonce,
}),
...(tokenType === PlatformAuthTokenType.DPOP_WITH_PROOF &&
dpopNonce && {
pop_nonce: dpopNonce,
}),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,34 @@ export type NativeAccountInfo = {
userName: string;
};

/**
* Bounded failure reasons emitted when validating a broker DPoP response.
*/
export type BrokerDpopFailureReason =
| "conflicting_fields"
| "invalid_attestation"
| "missing_attestation"
| "missing_l1_binding"
| "missing_proof"
| "unexpected_response"
| "unknown_token_type";

/**
* Validated binding outcome for a broker DPoP response.
*/
export type BrokerDpopOutcome = "none" | "L1" | "L3";

/**
* Normalized DPoP fields used to validate a broker response.
*/
export type NormalizedDpopBrokerResponse = {
tokenType?: string;
proof?: unknown;
bindingAttested?: boolean;
hasBindingAttested: boolean;
hasMalformedBindingAttested: boolean;
};

/**
* Token response returned by Native Platform
*/
Expand All @@ -36,6 +64,9 @@ export type PlatformAuthResponse = {
*/
export type NativeResponseProperties = {
MATS?: string;
token_type?: string;
DPoP?: string;
binding_attested?: string;
};

/**
Expand Down
16 changes: 16 additions & 0 deletions lib/msal-browser/src/cache/AsyncMemoryStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,22 @@ export class AsyncMemoryStorage<T> implements IAsyncStorage<T> {
}
}

/**
* Returns whether a key is available in persistent storage. Unlike
* containsKey, this does not consult the in-memory fallback.
*/
async containsKeyInPersistentStorage(
key: string,
correlationId: string
): Promise<boolean> {
try {
return await this.indexedDBCache.containsKey(key);
} catch (e) {
this.handleDatabaseAccessError(e, correlationId);
return false;
}
}

/**
* Returns true or false if the given key is present in the cache.
* @param key
Expand Down
20 changes: 19 additions & 1 deletion lib/msal-browser/src/cache/BrowserCacheManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1144,9 +1144,10 @@ export class BrowserCacheManager extends CacheManager {
throw cacheError;
}
// When cache quota is exceeded, start removing access tokens until we can successfully set the item
this.removeAccessToken(
await this.removeAccessTokenAndTokenBindingKey(
accessTokenKeys[i],
correlationId,
undefined,
false // Don't save token keys yet, do it at the end
);
} else {
Expand Down Expand Up @@ -1378,6 +1379,23 @@ export class BrowserCacheManager extends CacheManager {
updateTokenKeys && this.removeAccessTokenKeys([key], correlationId);
}

/**
* Removes an access token and awaits token-binding key cleanup.
*/
async removeAccessTokenAndTokenBindingKey(
key: string,
correlationId: string,
preservedKeyId?: string,
updateTokenKeys: boolean = true
): Promise<void> {
await super.removeAccessTokenAndTokenBindingKey(
key,
correlationId,
preservedKeyId
);
updateTokenKeys && this.removeAccessTokenKeys([key], correlationId);
}

/**
* Remove access token key from the key map
* @param key
Expand Down
Loading
Loading