Skip to content

Conversation

@neha-bhargava
Copy link
Contributor

@neha-bhargava neha-bhargava commented Apr 3, 2025

This pull request introduces a new interface IMsalSFHttpClientFactory to handle custom server certificate validation for Service Fabric scenarios and refactors the existing HTTP manager code to support this new interface. The most important changes include the addition of the new interface, modification of existing methods to use the new validation callback, and updates to various classes to ensure compatibility.

New Interface for Custom Certificate Validation:

Refactoring HTTP Manager:

Interface Updates:

Class Method Updates:

Additional Cleanups:

Changes proposed in this request

  • Update the SF flow to get a http client from the factory
  • Update the SimpleHttpClientFactory to implement the method to get client with handler
  • Update the HttpManager with the changes
  • Add tests
  • Update the tests

Testing

Performance impact

Documentation

  • All relevant documentation is updated.

@neha-bhargava neha-bhargava requested a review from a team as a code owner April 3, 2025 22:47
@neha-bhargava neha-bhargava marked this pull request as draft April 7, 2025 18:44
@neha-bhargava neha-bhargava marked this pull request as ready for review April 7, 2025 22:44
@gladjohn gladjohn requested a review from christothes April 8, 2025 14:18
@neha-bhargava neha-bhargava requested a review from Copilot April 9, 2025 00:01
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.

Copilot reviewed 18 out of 24 changed files in this pull request and generated 1 comment.

Files not reviewed (6)
  • src/client/Microsoft.Identity.Client/PublicApi/net462/PublicAPI.Unshipped.txt: Language not supported
  • src/client/Microsoft.Identity.Client/PublicApi/net472/PublicAPI.Unshipped.txt: Language not supported
  • src/client/Microsoft.Identity.Client/PublicApi/net8.0-android/PublicAPI.Unshipped.txt: Language not supported
  • src/client/Microsoft.Identity.Client/PublicApi/net8.0-ios/PublicAPI.Unshipped.txt: Language not supported
  • src/client/Microsoft.Identity.Client/PublicApi/net8.0/PublicAPI.Unshipped.txt: Language not supported
  • src/client/Microsoft.Identity.Client/PublicApi/netstandard2.0/PublicAPI.Unshipped.txt: Language not supported
Comments suppressed due to low confidence (1)

src/client/Microsoft.Identity.Client/Http/HttpManager.cs:155

  • [nitpick] There is an inconsistency in naming the certificate validation callback parameter ('validateServerCert' versus 'validateServerCertificate' in other parts of the code). Standardizing this naming across the codebase would improve clarity.
if (validateServerCert != null)

Copy link
Contributor

@gladjohn gladjohn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the PR looks good. well-commented, logically consistent, and with good test coverage. just some minor comments.

Copy link

@christothes christothes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@neha-bhargava neha-bhargava merged commit ba1d357 into main Apr 11, 2025
7 checks passed
@neha-bhargava neha-bhargava deleted the nebharg/SFHttpClientUpdates branch April 11, 2025 20:41
};

string key = handler.GetHashCode().ToString();
return s_httpClientPool.GetOrAdd(key, new HttpClient(handler));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there's any benefit from caching HttpClient. HttpClient is just a holder of handlers. It's the handlers that need to be cached.

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.

[Bug] Enable SF flow to get a HttpClient from the factory

6 participants