Skip to content

[Bug] `WithMtlsProofOfPossession()' if the region in the config is null. #5181

@ksaaf

Description

@ksaaf

Library version used

Latest

.NET version

NET 8

Scenario

ConfidentialClient - service to service (AcquireTokenForClient)

Is this a new or an existing app?

This is a new app or experiment

Issue description and reproduction steps

Currently, the WithMtlsProofOfPossession() validation logic ensures that requests with ServiceBundle.Config.AzureRegion with an MsalClientException (MsalError.MtlsPopWithoutRegion) for null or empty but not for whitespace.

Relevant code snippets

// Check for Azure region only if the authority is AAD
                if (ServiceBundle.Config.Authority.AuthorityInfo.AuthorityType == AuthorityType.Aad &&
                    string.IsNullOrEmpty(ServiceBundle.Config.AzureRegion))
                {
                    throw new MsalClientException(
                        MsalError.MtlsPopWithoutRegion,
                        MsalErrorMessage.MtlsPopWithoutRegion);
                }

Expected behavior

  • Requests with ServiceBundle.Config.AzureRegion set to whitespace should fail with an MsalClientException (MsalError.MtlsPopWithoutRegion).
  • Add unit tests

Identity provider

Microsoft Entra ID (Work and School accounts and Personal Microsoft accounts)

Regression

No response

Solution and workarounds

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions