Skip to content

Conversation

@vidai-msft
Copy link
Contributor

@vidai-msft vidai-msft commented Jul 17, 2025

Description

Make support for claims challenge with device code flow.

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • Update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

Copilot AI review requested due to automatic review settings July 17, 2025 03:46
@azure-client-tools-bot-prd
Copy link

Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.

@vidai-msft vidai-msft requested review from isra-fel and removed request for Copilot July 17, 2025 03:47
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

Adds support for passing a claims challenge through the device code authentication flow.

  • Wires a new ClaimsChallenge property onto DeviceCodeParameters and propagates it into TokenRequestContext
  • Updates factory and parameter classes to accept and forward the new claimsChallenge argument
  • Removes redundant ClaimsChallenge declarations in derived parameter classes

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Accounts/Authenticators/DeviceCodeAuthenticator.cs Includes ClaimsChallenge when constructing TokenRequestContext
src/Accounts/Authentication/Factories/AuthenticationFactory.cs Passes claimsChallenge into DeviceCodeParameters constructor
src/Accounts/Authentication/Authentication/Parameters/InteractiveWamParameters.cs Removed duplicate ClaimsChallenge property and forwarded to base
src/Accounts/Authentication/Authentication/Parameters/InteractiveParameters.cs Same removal of redundant ClaimsChallenge property
src/Accounts/Authentication/Authentication/Parameters/DeviceCodeParameters.cs Added ClaimsChallenge property and constructor parameter
Comments suppressed due to low confidence (3)

src/Accounts/Authentication/Authentication/Parameters/DeviceCodeParameters.cs:25

  • Introduce unit tests to validate that ClaimsChallenge is correctly propagated through DeviceCodeParameters into the TokenRequestContext and honored during the device code flow.
        public string ClaimsChallenge { get; set; }

src/Accounts/Authentication/Authentication/Parameters/DeviceCodeParameters.cs:25

  • Add an XML documentation comment summarizing the purpose of ClaimsChallenge, so consumers understand its role in the authentication flow.
        public string ClaimsChallenge { get; set; }

src/Accounts/Authentication/Factories/AuthenticationFactory.cs:665

  • The variable claimsChallenge is not defined in this scope, causing a compilation error. Retrieve the claims challenge value from the account properties (e.g., var claimsChallenge = account.GetProperty(AzureAccount.Property.ClaimsChallenge)) before passing it into the constructor.
                            return new DeviceCodeParameters(tokenCacheProvider, environment, tokenCache, tenant, resourceId, account.Id, homeAccountId, claimsChallenge);

@vidai-msft vidai-msft merged commit 3b990ea into main Jul 17, 2025
12 checks passed
@vidai-msft vidai-msft deleted the vidai/mfa-enforcement branch July 17, 2025 05:33
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