question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SignalR HubConnectionBuilder doesn't pass Client Certificate to server.

See original GitHub issue

This issue has been moved from a ticket on Developer Community.


[severity:I’m unable to use this version] Our external webserver is required client certificate in order to establish connection. When building HubConnection with HubConnectionBuilder, client certificate is added to options.ClientCertificates collection. But when try to access the certificate on Asp.Net server side HttpContext.Connection.ClientCertificate is null.

Very simple to reproduce: Just follow your example from https://docs.microsoft.com/en-us/aspnet/core/signalr/configuration?view=aspnetcore-6.0&tabs=dotnet

On client side:

var connection = new HubConnectionBuilder()
    .WithUrl("target url", options => {
...
        options.ClientCertificates.Add(/* ... */);
...
    })
    .Build();

On server side you can create a custom middleware just get access to the HttpContext, then if you examine HttpContext.Connection.ClientCertificate it is always null.

Please advice.

Thank you, Michael.


Original Comments

Feedback Bot on 4/6/2022, 01:08 AM:

(private comment, text removed)


Original Solutions

(no solutions)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
davidfowlcommented, May 16, 2022

We should update this doc to use ConfigureKestrel

builder.WebHost.ConfigureKestrel(options =>
{
    options.ConfigureHttpsDefaults(options =>
        options.ClientCertificateMode = ClientCertificateMode.RequireCertificate);
});
Read more comments on GitHub >

github_iconTop Results From Across the Web

Ignore SSL errors with signalR Core Client
When connecting to HTTPS, to always recognise the SSL certificate as successfully verified in the SignalR Core client you should do this in ......
Read more >
Authentication and authorization in ASP.NET Core SignalR
This validation is done only when the connection is established. During the life of the connection, the server doesn't automatically revalidate ...
Read more >
ASP.NET Core SignalR configuration
Configure bearer authentication​​ To provide authentication data along with SignalR requests, use the AccessTokenProvider option ( ...
Read more >
ASP.NET Core and SignalR Authentication (with the ...
If you are using the SignalR JavaScript client you'll realise that the access token is passed as a query parameter. If your project…...
Read more >
Build Real-time Applications with ASP.NET Core SignalR
Clients attempted to reconnect if a connection was lost, and the server buffered unsent messages and replayed them when a client reconnected.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found