Skip to content

ClientCertificateBinder Class

Model binder that supplies the negotiated TLS client X.509 certificate to an action parameter, enabling support for mutual-TLS client authentication and certificate-bound access tokens (RFC 8705). Reads from Microsoft.AspNetCore.Http.ConnectionInfo.ClientCertificate, falling back to Microsoft.AspNetCore.Http.ConnectionInfo.GetClientCertificateAsync(System.Threading.CancellationToken) for renegotiation. When the server is fronted by a reverse proxy that terminates TLS, register CertificateForwardingMiddleware beforehand so the forwarded header is hydrated into the connection.

C#
public class ClientCertificateBinder : Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder

Inheritance System.Object → ClientCertificateBinder

Implements Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder

Methods

ClientCertificateBinder.BindModelAsync(ModelBindingContext) Method

Resolves the client certificate for the current connection and assigns it as the binding result. The result is null when no certificate is present, which is the expected case for non-mTLS clients.

C#
public System.Threading.Tasks.Task BindModelAsync(Microsoft.AspNetCore.Mvc.ModelBinding.ModelBindingContext bindingContext);

Parameters

bindingContext Microsoft.AspNetCore.Mvc.ModelBinding.ModelBindingContext

Implements BindModelAsync(ModelBindingContext)

Returns

System.Threading.Tasks.Task