修改signalr的bug
This commit is contained in:
1 parent
c3ec557c4d
commit
68419bf7de
3 files changed
+280
-5
No files matched your search
@@ -56,11 +56,11 @@ namespace HHWMS.Web.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
var signined = UserSessionManager.IsUserSignined(user.Name);
|
||||
var signined = UserSessionManager.IsUserSignined(user.ITCode);
|
||||
if (signined)
|
||||
{
|
||||
// 踢人下线
|
||||
await KickUser(user.Name);
|
||||
await KickUser(user.ITCode);
|
||||
}
|
||||
//其他属性可以通过user.Attributes["aaa"] = "bbb"方式赋值
|
||||
Wtm.LoginUserInfo = user;
|
||||
@@ -85,8 +85,15 @@ namespace HHWMS.Web.Controllers
|
||||
}
|
||||
var principal = user.CreatePrincipal();
|
||||
|
||||
// 确保Principal包含ITCode claim,用于会话验证
|
||||
var identity = principal.Identity as System.Security.Claims.ClaimsIdentity;
|
||||
if (identity != null && !identity.HasClaim(c => c.Type == "ITCode"))
|
||||
{
|
||||
identity.AddClaim(new System.Security.Claims.Claim("ITCode", user.ITCode));
|
||||
}
|
||||
|
||||
await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, principal, properties);
|
||||
UserSessionManager.AddUserSession(user.Name,principal.Claims.First(c => c.Type == "SessionId").Value);
|
||||
UserSessionManager.AddUserSession(user.ITCode,principal.Claims.First(c => c.Type == "SessionId").Value);
|
||||
return Redirect(HttpUtility.UrlDecode(url));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user