cookie授权验证失败时返回登录界面

This commit is contained in:
2248356998 qq.com
2023-06-26 14:36:41 +08:00
parent 7eb94412d6
commit baabc155c8

View File

@@ -12,9 +12,9 @@
using Furion.Authorization;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Components;
using System.Security.Claims;
namespace ThingsGateway.Web.Core
{
@@ -42,8 +42,12 @@ namespace ThingsGateway.Web.Core
}
else
{
if (App.HttpContext != null)
{
var identity = new ClaimsIdentity();
App.HttpContext.User = new ClaimsPrincipal(identity);
}
Fail(context);
await App.HttpContext?.SignOutAsync();
}
}
else