File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -333,7 +333,18 @@ async Task<X509Certificate2> ITlsConnectionFeature.GetClientCertificateAsync(Can
333333 {
334334 if ( IsNotInitialized ( Fields . ClientCertificate ) )
335335 {
336- _clientCert = await Request . GetClientCertificateAsync ( cancellationToken ) ;
336+ var method = _requestContext . Server . Options . ClientCertificateMethod ;
337+ if ( method != ClientCertificateMethod . NoCertificate )
338+ {
339+ // Check if a cert was already available on the connection.
340+ _clientCert = Request . ClientCertificate ;
341+ }
342+
343+ if ( _clientCert == null && method == ClientCertificateMethod . AllowRenegotation )
344+ {
345+ _clientCert = await Request . GetClientCertificateAsync ( cancellationToken ) ;
346+ }
347+
337348 SetInitialized ( Fields . ClientCertificate ) ;
338349 }
339350 return _clientCert ;
Original file line number Diff line number Diff line change @@ -55,11 +55,11 @@ public string RequestQueueName
5555 public RequestQueueMode RequestQueueMode { get ; set ; }
5656
5757 /// <summary>
58- /// Indicates how client certificates should be populated. The default is to allow renegotation .
58+ /// Indicates how client certificates should be populated. The default is to allow a certificate without renegotiation .
5959 /// This does not change the netsh 'clientcertnegotiation' binding option which will need to be enabled for
6060 /// ClientCertificateMethod.AllowCertificate to resolve a certificate.
6161 /// </summary>
62- public ClientCertificateMethod ClientCertificateMethod { get ; set ; } = ClientCertificateMethod . AllowRenegotation ;
62+ public ClientCertificateMethod ClientCertificateMethod { get ; set ; } = ClientCertificateMethod . AllowCertificate ;
6363
6464 /// <summary>
6565 /// The maximum number of concurrent accepts.
You can’t perform that action at this time.
0 commit comments