Compare commits
No commits in common. "fed21316dfd0d9777fb724662b55c2c018417f6c" and "16e985b37e5e0cad1faa7fbb8a95b68ce1874817" have entirely different histories.
fed21316df
...
16e985b37e
|
|
@ -27,13 +27,6 @@ public static class CacheKeys
|
||||||
//超时没请求接口自动退出
|
//超时没请求接口自动退出
|
||||||
public static string UserAutoLoginOut(Guid userId) => $"UserAutoLoginOut:{userId}";
|
public static string UserAutoLoginOut(Guid userId) => $"UserAutoLoginOut:{userId}";
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 用户登录错误 限制登录
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="userName"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static string UserLoginError(string userName) => $"login-failures:{userName}";
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 跳过阅片
|
/// 跳过阅片
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -13033,13 +13033,6 @@
|
||||||
主要为了 处理项目结束 锁库,不允许操作
|
主要为了 处理项目结束 锁库,不允许操作
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:IRaCIS.Core.Application.Helper.CacheKeys.UserLoginError(System.String)">
|
|
||||||
<summary>
|
|
||||||
用户登录错误 限制登录
|
|
||||||
</summary>
|
|
||||||
<param name="userName"></param>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="M:IRaCIS.Core.Application.Helper.CacheKeys.SkipReadingCacheKey(System.Guid)">
|
<member name="M:IRaCIS.Core.Application.Helper.CacheKeys.SkipReadingCacheKey(System.Guid)">
|
||||||
<summary>
|
<summary>
|
||||||
跳过阅片
|
跳过阅片
|
||||||
|
|
|
||||||
|
|
@ -287,10 +287,6 @@ namespace IRaCIS.Core.Application.Service
|
||||||
IsFirstAdd = true
|
IsFirstAdd = true
|
||||||
});
|
});
|
||||||
|
|
||||||
var userName = _userRepository.Where(t => t.Id == userId).Select(t => t.UserName).FirstOrDefault();
|
|
||||||
|
|
||||||
await _fusionCache.RemoveAsync(CacheKeys.UserLoginError(userName));
|
|
||||||
|
|
||||||
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = userId, OptType = UserOptType.ResetPassword }, true);
|
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = userId, OptType = UserOptType.ResetPassword }, true);
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
return ResponseOutput.Ok();
|
||||||
|
|
@ -696,11 +692,12 @@ namespace IRaCIS.Core.Application.Service
|
||||||
public async Task<IResponseOutput<LoginReturnDTO>> Login(string userName, string password)
|
public async Task<IResponseOutput<LoginReturnDTO>> Login(string userName, string password)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
const string cachePrefix = "login-failures:";
|
||||||
int maxFailures = _verifyConfig.CurrentValue.LoginMaxFailCount;
|
int maxFailures = _verifyConfig.CurrentValue.LoginMaxFailCount;
|
||||||
int lockoutMinutes = _verifyConfig.CurrentValue.LoginFailLockMinutes;
|
int lockoutMinutes = _verifyConfig.CurrentValue.LoginFailLockMinutes;
|
||||||
|
|
||||||
// 生成缓存键
|
// 生成缓存键
|
||||||
string cacheKey = CacheKeys.UserLoginError(userName);
|
string cacheKey = $"{cachePrefix}{userName}";
|
||||||
|
|
||||||
// 从缓存中获取登录失败次数
|
// 从缓存中获取登录失败次数
|
||||||
int? failCount = await _fusionCache.GetOrDefaultAsync<int?>(cacheKey);
|
int? failCount = await _fusionCache.GetOrDefaultAsync<int?>(cacheKey);
|
||||||
|
|
|
||||||
|
|
@ -65,13 +65,6 @@ namespace IRaCIS.Core.Application.Service
|
||||||
[RoutePattern(HttpMethod = "Get")]
|
[RoutePattern(HttpMethod = "Get")]
|
||||||
public async Task<IResponseOutput> TestPKCECallBackAsync(string code)
|
public async Task<IResponseOutput> TestPKCECallBackAsync(string code)
|
||||||
{
|
{
|
||||||
var httpClient = new HttpClient();
|
|
||||||
var disco = await httpClient.GetDiscoveryDocumentAsync("https://logto.test.extimaging.com/oidc");
|
|
||||||
if (disco.IsError)
|
|
||||||
{
|
|
||||||
Console.WriteLine(disco.Error);
|
|
||||||
}
|
|
||||||
|
|
||||||
string codeVerifier = "QMSBBxTQrpKPscvNNfmaQfmyk5Wd33GZS1FKSo3Shv8w-59vW1iTSlgAznYojkYv2DgR4XhTqySsBnDPq0";
|
string codeVerifier = "QMSBBxTQrpKPscvNNfmaQfmyk5Wd33GZS1FKSo3Shv8w-59vW1iTSlgAznYojkYv2DgR4XhTqySsBnDPq0";
|
||||||
// OIDC 配置,替换为您的 OIDC 提供者的配置
|
// OIDC 配置,替换为您的 OIDC 提供者的配置
|
||||||
string tokenEndpoint = "https://logto.test.extimaging.com/oidc/token"; // 替换为实际 token 端点
|
string tokenEndpoint = "https://logto.test.extimaging.com/oidc/token"; // 替换为实际 token 端点
|
||||||
|
|
@ -108,14 +101,6 @@ namespace IRaCIS.Core.Application.Service
|
||||||
var userResponse = await client.ExecuteAsync(userInfoRequest);
|
var userResponse = await client.ExecuteAsync(userInfoRequest);
|
||||||
|
|
||||||
Console.WriteLine(userResponse.Content);
|
Console.WriteLine(userResponse.Content);
|
||||||
|
|
||||||
//结束回话
|
|
||||||
|
|
||||||
var endUrl = new RequestUrl(disco.EndSessionEndpoint).CreateEndSessionUrl(tokenResponse.IdToken, "http://localhost:6100/OAuth/TestPCKEOrgin");
|
|
||||||
|
|
||||||
var _endHttpClient = new HttpClient();
|
|
||||||
|
|
||||||
var dd = await _endHttpClient.GetAsync(endUrl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResponseOutput.Ok();
|
return ResponseOutput.Ok();
|
||||||
|
|
@ -203,18 +188,10 @@ namespace IRaCIS.Core.Application.Service
|
||||||
|
|
||||||
Console.WriteLine(formattedJson);
|
Console.WriteLine(formattedJson);
|
||||||
|
|
||||||
var tokenResponse = JsonConvert.DeserializeObject<LogtoTokenResponse>(responseBody);
|
var tokenResponse=JsonConvert.DeserializeObject<LogtoTokenResponse>(responseBody);
|
||||||
|
|
||||||
Console.WriteLine(tokenResponse);
|
Console.WriteLine(tokenResponse);
|
||||||
|
|
||||||
//结束回话
|
|
||||||
|
|
||||||
var endUrl = new RequestUrl(disco.EndSessionEndpoint).CreateEndSessionUrl(tokenResponse.IdToken, "http://localhost:6100/OAuth/TestPCKEOrgin");
|
|
||||||
|
|
||||||
var _endHttpClient = new HttpClient();
|
|
||||||
|
|
||||||
var dd = await _endHttpClient.GetAsync(endUrl);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -333,7 +310,6 @@ namespace IRaCIS.Core.Application.Service
|
||||||
string clientId = "tl42rjin7obxtwqqgvkti";
|
string clientId = "tl42rjin7obxtwqqgvkti";
|
||||||
string clientSecret = "Pu9ig4rz44aLlxb0yKUaOiZaFk6Bcu51";
|
string clientSecret = "Pu9ig4rz44aLlxb0yKUaOiZaFk6Bcu51";
|
||||||
string redirectUri = "http://localhost:6100/OAuth/TestOidcClientCallBack"; // 替换为前端的回调 URL
|
string redirectUri = "http://localhost:6100/OAuth/TestOidcClientCallBack"; // 替换为前端的回调 URL
|
||||||
string postLogoutRedirectUri = "http://localhost:6100/OAuth/TestPCKEOrgin"; //退出回话重定向到前端的url
|
|
||||||
// 准备请求内容
|
// 准备请求内容
|
||||||
var tokenRequest = new AuthorizationCodeTokenRequest
|
var tokenRequest = new AuthorizationCodeTokenRequest
|
||||||
{
|
{
|
||||||
|
|
@ -392,8 +368,6 @@ namespace IRaCIS.Core.Application.Service
|
||||||
Console.WriteLine("RefreshToken:" + refreshResponse.RefreshToken);
|
Console.WriteLine("RefreshToken:" + refreshResponse.RefreshToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue