Merge branch 'master' of https://gitea.nxsir.cn/nanxun/IM_NEW
This commit is contained in:
@@ -40,7 +40,9 @@ namespace IM.Jwt
|
||||
{
|
||||
var accessToken = context.Request.Query["access_token"];
|
||||
var path = context.HttpContext.Request.Path;
|
||||
if (!string.IsNullOrEmpty(accessToken) && path.StartsWithSegments("/hub")) // 假设你的 SignalR 路径是 /hub
|
||||
// SignalR WebSocket 握手时 token 通过 query string 传递(不是 Authorization 头)
|
||||
// Hub 路径为 /chat(见 ConnectorService/Program.cs)
|
||||
if (!string.IsNullOrEmpty(accessToken) && path.StartsWithSegments("/chat"))
|
||||
{
|
||||
context.Token = accessToken;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user