Skip to content
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

initial commit for adding aadIssuerValidatorOptions #696

Merged
merged 5 commits into from
Oct 21, 2020
Merged

Conversation

jennyf19
Copy link
Collaborator

@jennyf19 jennyf19 marked this pull request as draft October 19, 2020 20:46
Comment on lines 12 to 15
/// Sets the name of the HttpClientFactory to use with the configuration manager.
/// Needed when setting up a proxy.
/// </summary>
public string? HttpClientFactoryName { get; set; } = null!;
Copy link

@Tratcher Tratcher Oct 19, 2020

Choose a reason for hiding this comment

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

Suggested change
/// Sets the name of the HttpClientFactory to use with the configuration manager.
/// Needed when setting up a proxy.
/// </summary>
public string? HttpClientFactoryName { get; set; } = null!;
/// Sets the name of the HttpClient to get from the IHttpClientFactory for use with the configuration manager.
/// Needed when customizing the client such as configuring a proxy.
/// </summary>
public string? HttpClientName { get; set; } = null!;

Copy link
Collaborator

Choose a reason for hiding this comment

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

@Tratcher: the thing I don't fully get is the proxy configuration is a static property of HttpClient?
But I understand that for the default headers etc ... this is important.

Choose a reason for hiding this comment

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

Yeah, you don't want the static, you want to set the instance property on SocketsHttpHandler when creating the HttpClient.
https://docs.microsoft.com/en-us/dotnet/api/system.net.http.socketshttphandler.proxy?view=netcore-3.1#System_Net_Http_SocketsHttpHandler_Proxy

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@Tratcher i see. makes sense. will add to our documentation when we release.

new ConfigurationManager<IssuerMetadata>(
Constants.AzureADIssuerMetadataUrl,
new IssuerConfigurationRetriever(),
httpClientFactory?.CreateClient(aadIssuerValidatorOptions?.Value?.HttpClientFactoryName));

Choose a reason for hiding this comment

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

What's with all the ?? None of these things should be null when activated from DI.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

that's for the unit test to pass, otherwise i have to configure all the service, etc..., which i might do or leave as an integration test instead.

@@ -15,9 +17,20 @@ namespace Microsoft.Identity.Web.Resource
/// </summary>
internal class MicrosoftIdentityIssuerValidatorFactory
{
public MicrosoftIdentityIssuerValidatorFactory(
IOptions<AadIssuerValidatorOptions> aadIssuerValidatorOptions,
IHttpClientFactory httpClientFactory)

Choose a reason for hiding this comment

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

Did you need to add a package dependency for this? You at least need to register it in DI.

Copy link
Collaborator

Choose a reason for hiding this comment

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

no need to add a package dependency. IHttpClientFactory is already used by Microsoft.Identity.Web

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

right, what @jmprieur said.

@jennyf19 jennyf19 marked this pull request as ready for review October 20, 2020 22:04
Copy link
Collaborator

@jmprieur jmprieur left a comment

Choose a reason for hiding this comment

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

LGTM
Thanks @jennyf19 !

@jennyf19 jennyf19 marked this pull request as draft October 20, 2020 22:10
@jennyf19
Copy link
Collaborator Author

@jmprieur i need to do some more testing, so will update accordingly.

@jennyf19 jennyf19 marked this pull request as ready for review October 21, 2020 15:52
Copy link
Collaborator

@jmprieur jmprieur left a comment

Choose a reason for hiding this comment

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

Thanks @jennyf19
More happy customers :)

🚢

@jennyf19 jennyf19 merged commit 967c4c6 into master Oct 21, 2020
@jennyf19 jennyf19 deleted the jennyf/proxy branch October 21, 2020 17:30
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.

3 participants