Skip to content

HttpClient client certificate support #999

Open

Description

@Tratcher

In preview 12 #994 reverted support for client certificates on the proxy http client for the following reasons:

  • It's different between the json config model and the code config model
  • it requires passwords in the json config
  • There's no rotation support, you have to modify the cluster config to point at a new cert and trigger a reload
  • Multiple config provider implementations are using System.Text.Json to serialize the code model across processes, but that doesn't make sense for X509Certificate2.
  • Cert lifetime issues across config reloads. The current model requires a complex weak reference cache.

For now people need to use the ProxyHttpClientFactory customizations to add their client certificate programmatically. They become responsible for managing the credentials and lifetime of the certs.

We do still want to have this feature, but we need to address the above concerns. One idea is to move the certificate management to its own service so that it's pluggable and would work independently of the config provider. HttpClientConfig for the cluster would reference the certificate by string id, similar to how auth and cors policies work. Then ProxyHttpClientFactory would call into the cert service to retrieve the matching cert. There would need to be implementations of the service that supported the following:

  • Let callers look up certs by name (Contains(name), TryGetCert(name, out cert))
  • Loading certificates from a variety of locations and monitor them for changes. An implementation may only need to support one location type and you'd switch implementations to support other sources, much like IProxyConfigProvider.
  • Some way for the service to trigger a config reload notification when a cert change was detected so ProxyHttpClientFactory can re-run

Activity

  1. added
    Type: Idea
    on May 14, 2021
  2. karelz commented on May 25, 2021

    @karelz
    Member

    Triage: We have sample in ProxyHttpClientFactory, backlog ...

  3. added this to the Backlog milestone on May 25, 2021
  4. self-assigned this
    on May 25, 2021
  5. Tratcher commented on May 25, 2021

    @Tratcher
    MemberAuthor

    Note to self, update the ProxyHttpClientFactory docs/sample to show setting a client cert.

  6. removed their assignment
    on May 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: Ideasample-needed

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions