Skip to content

Setting the ClientCertificateMode Kestrel server option from an appsettings.json file. #18660

Closed
@javs-ctr

Description

@javs-ctr

Creating this issue was recommended to me from a response to the AspNetCore.Docs issue #16759 I created previously.

Context: From the Microsoft Docs entry for the Kestrel web server implementation in ASP.NET Core, under the Kestrel options section, the following is a description about configuring Kestrel options:

Kestrel options, which are configured in C# code in the following examples, can also be set using a configuration provider. For example, the File Configuration Provider can load Kestrel configuration from an appsettings.json or appsettings.{Environment}.json file:

I would like to use the Kestrel web server for local development and IIS for the remote web hosting of an ASP.NET Core web application.

I have successfully followed the Configure your host to require certificates in Program.cs for the Kestrel web server.

Issue: It would be nice to be able to configure the ClientCertificateMode property of the HttpsConnectionAdapterOptions class from an appsettings.json file, somewhat similar to how the EndpointsDefault property is configured in the appsettings.json file, documented in the Endpoint configuration section of the Kestrel Microsoft Docs entry. The EndpointsDefault property is a sibling property of the HttpsDefaults property in the KestrelServerOptions class, and I made an (incorrect) assumption that it would be configurable from an appsettings.json file.

In the response to the previous Microsoft Docs issue I created, the ConfigurationReader.cs class was linked, providing a Rosetta Stone like tool for comprehending the mapping between the KestrelServerOptions class members and the corresponding appsettings.json configuration file keys and values. While the HttpsDefaults key is not found in the ConfigurationReader class like the EndpointDefaults key, might there be in a future update the addition of the HttpsDefaults key with the option to set the ClientCertificateMode configuration value?

cc: @guardrex

Metadata

Metadata

Assignees

No one assigned

    Labels

    DoneThis issue has been fixedarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsenhancementThis issue represents an ask for new feature or an enhancement to an existing onefeature-kestrelgood first issueGood for newcomers.help wantedUp for grabs. We would accept a PR to help resolve this issue

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions