Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 3, 2025

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

    • Add allowPlatformBrokerWithDOM configuration flag to BrowserSystemOptions
    • Update Configuration.ts to support new flag and validation
    • Update PlatformAuthProvider.ts to support DOM config parameter
    • Remove deprecated isDomEnabledForPlatformAuth function
    • Add validation to prevent invalid configuration (allowPlatformBrokerWithDOM without allowPlatformBroker)
    • Update StandardController to pass DOM config to getPlatformAuthProvider
  • Update error handling

    • Add invalidPlatformBrokerConfiguration error code to msal-common
  • Update documentation

    • Update device-bound-tokens.md with DOM API information
    • Update platform broker terminology (WAM -> platform broker)
  • Update API surface

    • Update msal-browser.api.md with new configuration option
    • Update msal-browser.api.md with updated isPlatformBrokerAvailable signature
    • Update msal-common.api.md with new error codes
    • Add note about v6 signature reversion
  • Update tests

    • Update PlatformAuthProvider tests
    • Update PublicClientApplication tests
    • Add tests for invalid configuration scenarios
    • Add test for valid configuration (both flags enabled)
    • Remove isDomEnabledForPlatformAuth tests
  • Add beachball change files

    • Create change file for msal-browser (minor)
    • Create change file for msal-common (patch)
  • Update isPlatformBrokerAvailable signature (NEW REQUIREMENT)

    • Change signature to require domConfig as first mandatory parameter
    • Update internal usage in getPlatformAuthProvider
    • Update all test usages
    • Fix parameter order to match API documentation
  • Update API documentation

    • Run API extractor to update .api.md files
  • Validate changes

    • Build msal-common
    • Build msal-browser
    • Run tests for msal-browser
    • Run linter (pre-existing warnings only)
  • Address PR feedback

    • Fix function call parameter order
    • Add v6 reversion note to API docs
    • Fix isPlatformBrokerAvailable parameter order
    • Add test for valid configuration

Summary

Successfully migrated all changes from PR #8171 to the msal-v5 branch with the following key modifications:

Core Changes:

  • Added allowPlatformBrokerWithDOM configuration flag to enable DOM API support for platform brokering
  • Updated isPlatformBrokerAvailable to require domConfig as the first mandatory parameter (as requested)
  • Removed deprecated isDomEnabledForPlatformAuth function that relied on session storage
  • Added validation to prevent invalid configuration when allowPlatformBrokerWithDOM is enabled without allowPlatformBroker

Error Handling:

  • Added new error code invalidPlatformBrokerConfiguration to msal-common

Documentation:

  • Updated device-bound-tokens.md with DOM API information and platform broker terminology
  • Updated API documentation files for both packages
  • Added note that signature will be reverted in v6

Tests:

  • Updated all tests to use new isPlatformBrokerAvailable signature
  • Added test for invalid configuration scenario
  • Added test for valid configuration scenario (both flags enabled)
  • All tests pass successfully

Build & Validation:

  • Both msal-common and msal-browser build successfully
  • All tests pass
  • Linting passes (only pre-existing warnings remain)
Original prompt
  1. Migrate all changes (including code, configuration, documentation, and tests) from PR Enable Edge API for Platform brokering #8171 (Enable Edge API for Platform brokering #8171), which enabled Edge API for platform brokering, to the new branch enable-edge-api-msal-v5 based on msal-v5.
  2. Ensure all related test cases from the original PR and any dependent commits are also migrated to this new branch.
  3. Once migration is complete and all tests pass, update the method signature for isPlatformBrokerAvailable to require domConfig as the mandatory first parameter (instead of an optional parameter or spread arguments).
  4. Update all usage and tests for isPlatformBrokerAvailable to reflect domConfig as a required first parameter.
  5. Open a pull request from enable-edge-api-msal-v5 to msal-v5 branch including the above changes.

This pull request was created as a result of the following prompt from Copilot chat.

  1. Migrate all changes (including code, configuration, documentation, and tests) from PR Enable Edge API for Platform brokering #8171 (Enable Edge API for Platform brokering #8171), which enabled Edge API for platform brokering, to the new branch enable-edge-api-msal-v5 based on msal-v5.
  2. Ensure all related test cases from the original PR and any dependent commits are also migrated to this new branch.
  3. Once migration is complete and all tests pass, update the method signature for isPlatformBrokerAvailable to require domConfig as the mandatory first parameter (instead of an optional parameter or spread arguments).
  4. Update all usage and tests for isPlatformBrokerAvailable to reflect domConfig as a required first parameter.
  5. Open a pull request from enable-edge-api-msal-v5 to msal-v5 branch including the above changes.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits December 3, 2025 20:42
- 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]>
Copilot AI changed the title [WIP] Migrate Edge API changes and update method signature Migrate Edge API platform brokering to msal-v5 with required domConfig parameter Dec 3, 2025
Copilot AI requested a review from sameerag December 3, 2025 20:59
Copilot finished work on behalf of sameerag December 3, 2025 20:59
@sameerag sameerag changed the title Migrate Edge API platform brokering to msal-v5 with required domConfig parameter [v5] Migrate Edge API platform brokering to msal-v5 with required domConfig parameter Dec 3, 2025
- 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]>
@sameerag sameerag changed the base branch from enable-edge-api-msal-v5 to msal-v5 December 3, 2025 22:48
Copilot AI requested a review from sameerag December 3, 2025 22:49
Copilot finished work on behalf of sameerag December 3, 2025 22:49
@sameerag sameerag marked this pull request as ready for review December 4, 2025 18:02
@sameerag sameerag requested a review from a team as a code owner December 4, 2025 18:02
Copilot AI review requested due to automatic review settings December 4, 2025 18:02
Copilot finished reviewing on behalf of sameerag December 4, 2025 18:06
Copy link
Contributor

Copilot AI left a 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 allowPlatformBrokerWithDOM configuration option to enable DOM API-based platform brokering
  • Updated isPlatformBrokerAvailable function signature to require domConfig parameter
  • Removed deprecated isDomEnabledForPlatformAuth function 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

Comment on lines +248 to +266
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
);
});
Copy link

Copilot AI Dec 4, 2025

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);
});

Copilot uses AI. Check for mistakes.
Copy link
Member

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

Copy link
Contributor Author

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.

- 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]>
Copilot finished work on behalf of sameerag December 4, 2025 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants