自动退出登录
parent
e57887eba5
commit
70ababc2d9
|
@ -59,7 +59,8 @@
|
|||
|
||||
"LoginMaxFailCount": 5,
|
||||
|
||||
"LoginFailLockMinutes": 1
|
||||
"LoginFailLockMinutes": 1,
|
||||
"AutoLoginOutMinutes": 10
|
||||
},
|
||||
|
||||
"SystemEmailSendConfig": {
|
||||
|
|
|
@ -35,6 +35,8 @@ public class LimitUserRequestAuthorization : IAsyncAuthorizationFilter
|
|||
|
||||
public async Task OnAuthorizationAsync(AuthorizationFilterContext context)
|
||||
{
|
||||
var minutes = _verifyConfig.CurrentValue.AutoLoginOutMinutes;
|
||||
|
||||
if (_verifyConfig.CurrentValue.OpenLoginLimit)
|
||||
{
|
||||
if (context.ActionDescriptor.EndpointMetadata.Any(item => item is IAllowAnonymous))
|
||||
|
@ -65,7 +67,7 @@ public class LimitUserRequestAuthorization : IAsyncAuthorizationFilter
|
|||
if (string.IsNullOrWhiteSpace(cacheUserToken))
|
||||
{
|
||||
//设置当前用户最新Token
|
||||
await _provider.SetAsync(_userInfo.Id.ToString(), _userInfo.UserToken, TimeSpan.FromDays(7));
|
||||
await _provider.SetAsync(_userInfo.Id.ToString(), _userInfo.UserToken, TimeSpan.FromMinutes(minutes));
|
||||
|
||||
cacheUserToken = _userInfo.UserToken;
|
||||
|
||||
|
@ -73,7 +75,7 @@ public class LimitUserRequestAuthorization : IAsyncAuthorizationFilter
|
|||
//是同一个人
|
||||
else if (cacheUserToken == _userInfo.UserToken)
|
||||
{
|
||||
|
||||
await _provider.SetAsync(_userInfo.Id.ToString(), _userInfo.UserToken, TimeSpan.FromMinutes(minutes));
|
||||
}
|
||||
|
||||
else
|
||||
|
|
|
@ -21,6 +21,7 @@ namespace IRaCIS.Core.Domain.Share
|
|||
|
||||
public int LoginFailLockMinutes { get; set; }
|
||||
|
||||
public int AutoLoginOutMinutes { get; set; }
|
||||
}
|
||||
|
||||
public class SystemEmailSendConfig
|
||||
|
|
Loading…
Reference in New Issue