-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Milestone
Description
The docfx examples for ServerServiceCollectionExtensions / AddIceRpcServer don't show the installation of the server certificate.
See GenericHost example for the proper setup:
// Load and register the server certificate as a singleton so it stays alive and gets disposed.
services.AddSingleton<X509Certificate2>(sp =>
X509CertificateLoader.LoadPkcs12FromFile(
Path.Combine(
hostContext.HostingEnvironment.ContentRootPath,
hostContext.Configuration.GetValue<string>("Certificate:File")!),
password: null,
keyStorageFlags: X509KeyStorageFlags.Exportable));
// Bind the server options to the "appsettings.json" configuration "Server" section, and add a Configure
// callback to configure its authentication options.
services
.AddOptions<ServerOptions>()
.Bind(hostContext.Configuration.GetSection("Server"))
.Configure<X509Certificate2>((options, serverCertificate) =>
options.ServerAuthenticationOptions = CreateServerAuthenticationOptions(serverCertificate));As a result, these docfx examples are incomplete and potentially confusing.
For the GenericHost example, we use a helper to create the server authentication options, but not the the docfx examples. Maybe we should add this helper to the docfx examples?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels