-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[v5] Migrate Edge API platform brokering to msal-v5 with required domConfig parameter #8177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: msal-v5
Are you sure you want to change the base?
Conversation
- Add allowPlatformBrokerWithDOM configuration flag - Update isPlatformBrokerAvailable to require domConfig as first parameter - Remove deprecated isDomEnabledForPlatformAuth function - Add error validation for invalid platform broker configuration - Update documentation with platform broker terminology and DOM API support Co-authored-by: sameerag <[email protected]>
- Update PlatformAuthProvider tests to use new isPlatformBrokerAvailable signature - Update PublicClientApplication tests for DOM config support - Remove deprecated isDomEnabledForPlatformAuth tests - Add test for invalid configuration error - Add beachball change files for msal-browser (minor) and msal-common (patch) - Fix linting issues Co-authored-by: sameerag <[email protected]>
- Update msal-common.api.md with new error code - Update msal-browser.api.md with new configuration flag and updated isPlatformBrokerAvailable signature Co-authored-by: sameerag <[email protected]>
- Fix missing comma in getPlatformAuthProvider call (pass domConfig as last parameter) - Add note to API documentation that signature will be reverted in v6 when allowPlatformBrokerWithDOM is folded into allowPlatformBroker Co-authored-by: sameerag <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR migrates Edge API platform brokering functionality from PR #8171 to the msal-v5 branch. The key change updates isPlatformBrokerAvailable to require domConfig as a mandatory first parameter, enabling platform broker support through DOM APIs in Edge browser. The PR adds a new configuration flag allowPlatformBrokerWithDOM and includes validation to prevent invalid configurations.
- Added
allowPlatformBrokerWithDOMconfiguration option to enable DOM API-based platform brokering - Updated
isPlatformBrokerAvailablefunction signature to requiredomConfigparameter - Removed deprecated
isDomEnabledForPlatformAuthfunction that relied on session storage - Added configuration validation and new error code
invalidPlatformBrokerConfiguration
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/msal-common/src/error/ClientConfigurationErrorCodes.ts | Adds new error code for invalid platform broker configuration |
| lib/msal-common/apiReview/msal-common.api.md | Updates API documentation to include new error code |
| lib/msal-browser/test/broker/PlatformAuthProvider.spec.ts | Updates tests for new function signatures and removes deprecated function tests |
| lib/msal-browser/test/app/PublicClientApplication.spec.ts | Updates tests to use new configuration flag |
| lib/msal-browser/src/controllers/StandardController.ts | Passes DOM config parameter to platform auth provider |
| lib/msal-browser/src/config/Configuration.ts | Adds new configuration option with default value |
| lib/msal-browser/src/broker/nativeBroker/PlatformAuthProvider.ts | Updates function signatures and removes deprecated function |
| lib/msal-browser/docs/device-bound-tokens.md | Documents DOM API feature and updated platform broker terminology |
| lib/msal-browser/apiReview/msal-browser.api.md | Updates API documentation with new configuration and function signature |
| change/@azure-msal-common-edge-api-dom-support.json | Beachball changefile for msal-common patch |
| change/@azure-msal-browser-edge-api-dom-support.json | Beachball changefile for msal-browser minor version |
| it("throws error when allowPlatformBrokerWithDOM is enabled without allowPlatformBroker", () => { | ||
| config.system.allowPlatformBroker = false; | ||
| config.system.allowPlatformBrokerWithDOM = true; | ||
| expect(() => { | ||
| PlatformAuthProvider.isPlatformAuthAllowed( | ||
| config, | ||
| logger, | ||
| TEST_CONFIG.CORRELATION_ID, | ||
| new PlatformAuthDOMHandler( | ||
| logger, | ||
| performanceClient, | ||
| "test-correlation-id" | ||
| ), | ||
| Constants.AuthenticationScheme.BEARER | ||
| ); | ||
| }).toThrow( | ||
| ClientConfigurationErrorCodes.invalidPlatformBrokerConfiguration | ||
| ); | ||
| }); |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a test case for the valid configuration scenario where both allowPlatformBroker and allowPlatformBrokerWithDOM are set to true. This would ensure that the validation logic correctly allows this configuration. For example:
it("returns true when both allowPlatformBroker and allowPlatformBrokerWithDOM are enabled", () => {
config.system.allowPlatformBroker = true;
config.system.allowPlatformBrokerWithDOM = true;
const result = PlatformAuthProvider.isPlatformAuthAllowed(
config,
logger,
TEST_CONFIG.CORRELATION_ID,
new PlatformAuthDOMHandler(
logger,
performanceClient,
"test-correlation-id"
),
Constants.AuthenticationScheme.BEARER
);
expect(result).toBe(true);
});There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added test case in commit f8fcfe8 for the valid configuration scenario where both allowPlatformBroker and allowPlatformBrokerWithDOM are enabled.
lib/msal-browser/src/broker/nativeBroker/PlatformAuthProvider.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
- Fix parameter order: domConfig is now first mandatory parameter (not last optional) - Add test case for valid configuration with both allowPlatformBroker and allowPlatformBrokerWithDOM enabled - Ensures signature matches API documentation and test usage Co-authored-by: sameerag <[email protected]>
Migration Plan: Edge API for Platform Brokering to msal-v5
Migrate core changes from PR Enable Edge API for Platform brokering #8171 to enable-edge-api-msal-v5 branch
allowPlatformBrokerWithDOMconfiguration flag to BrowserSystemOptionsisDomEnabledForPlatformAuthfunctionUpdate error handling
Update documentation
Update API surface
Update tests
Add beachball change files
Update
isPlatformBrokerAvailablesignature (NEW REQUIREMENT)domConfigas first mandatory parameterUpdate API documentation
Validate changes
Address PR feedback
Summary
Successfully migrated all changes from PR #8171 to the msal-v5 branch with the following key modifications:
Core Changes:
allowPlatformBrokerWithDOMconfiguration flag to enable DOM API support for platform brokeringisPlatformBrokerAvailableto requiredomConfigas the first mandatory parameter (as requested)isDomEnabledForPlatformAuthfunction that relied on session storageallowPlatformBrokerWithDOMis enabled withoutallowPlatformBrokerError Handling:
invalidPlatformBrokerConfigurationto msal-commonDocumentation:
Tests:
isPlatformBrokerAvailablesignatureBuild & Validation:
Original prompt
This pull request was created as a result of the following prompt from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.