I am using JWT authentication tokens in an ASP .NET Core Web API application. The tokens are generated by the API itself, not by a third party. I added SignalR sucessfully to the stack, but now I need to authenticate the users that are trying to execute server (Hub) methods. Someone suggested to pass the token in the "qs" property in JavaScript. This will not work for me as our tokens are really large (they contain lots of claims). I tried writing a custom middleware for reading the token from the payload and auto-authenticating the user. The problem is that, when using WebSockets, the middleware is not executed. Any ideas will help.
相关问题
- java client program to send digest authentication
- PHP persistent login - Do i reissue a cookie after
- How to verify laravel passport api token in node /
- Can I use MvcJsonOptions configured during Startup
- Singleton with AsyncLocal vs Scope Service
相关文章
- 关于SignalR的问题
- 关于SignalR的问题
- How to get a list of connected clients on SignalR
- EF Core 'another instance is already being tra
- Re-target .NET Core to net471, net 472
- Securing REST endpoint using spring security
- How to replace Middleware in integration tests pro
- Why CsvHelper not reading from MemoryStream?
Have a look at article that suggests to use query string Authenticate against a ASP.NET Core 1.0 (vNext) SignalR application using JWT. I know that your token is too long, but author explains how to use middleware to authenticate the request.
Here is the summary from the article:
I have highlighted the key point that your custom middleware should be registered before Jwt middleware.
From this answer you can create a WebSocket connection and pass your token as basic auth parameter: