|
|
@@ -1,8 +1,4 @@
|
|
|
-
|
|
|
-using Flurl.Http.Configuration;
|
|
|
-using Microsoft.AspNetCore.SignalR;
|
|
|
-using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
|
|
-using NPOI.SS.Formula.Functions;
|
|
|
+using Microsoft.AspNetCore.SignalR;
|
|
|
using OASystem.API.OAMethodLib;
|
|
|
using OASystem.API.OAMethodLib.Hotmail;
|
|
|
using OASystem.API.OAMethodLib.Hub.HubClients;
|
|
|
@@ -55,15 +51,15 @@ namespace OASystem.API.Controllers
|
|
|
/// <param name="hotmailService"></param>
|
|
|
/// <param name="httpClientFactory"></param>
|
|
|
public AuthController(
|
|
|
- IConfiguration config,
|
|
|
- LoginRepository loginRep,
|
|
|
- IMapper mapper,
|
|
|
+ IConfiguration config,
|
|
|
+ LoginRepository loginRep,
|
|
|
+ IMapper mapper,
|
|
|
MessageRepository message,
|
|
|
- SystemMenuPermissionRepository sysMenuPermRep,
|
|
|
- IQiYeWeChatApiService qiYeWeChatApiService,
|
|
|
+ SystemMenuPermissionRepository sysMenuPermRep,
|
|
|
+ IQiYeWeChatApiService qiYeWeChatApiService,
|
|
|
MessageRepository messageRep,
|
|
|
DeviceTokenRepository deviceRep,
|
|
|
- IHubContext<ChatHub,IChatClient> hubContext,
|
|
|
+ IHubContext<ChatHub, IChatClient> hubContext,
|
|
|
HotmailService hotmailService,
|
|
|
System.Net.Http.IHttpClientFactory httpClientFactory)
|
|
|
{
|
|
|
@@ -506,7 +502,7 @@ namespace OASystem.API.Controllers
|
|
|
var sb = new StringBuilder();
|
|
|
|
|
|
foreach (var hotmailConfig in hotmailConfigs)
|
|
|
- {
|
|
|
+ {
|
|
|
var result = await _hotmailService.ForceRefreshTokenAsync(hotmailConfig.UserName);
|
|
|
sb.AppendLine($"User: {hotmailConfig.UserName} -> {result};");
|
|
|
}
|
|
|
@@ -545,7 +541,7 @@ namespace OASystem.API.Controllers
|
|
|
{ "grant_type", "authorization_code" },
|
|
|
// 换取时再次明确 scope
|
|
|
{ "scope", "openid offline_access Mail.ReadWrite Mail.Send User.Read" }
|
|
|
-
|
|
|
+
|
|
|
};
|
|
|
|
|
|
var response = await httpClient.PostAsync("https://login.microsoftonline.com/common/oauth2/v2.0/token", new FormUrlEncodedContent(tokenRequest));
|
|
|
@@ -666,7 +662,7 @@ namespace OASystem.API.Controllers
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
public IActionResult RateTest()
|
|
|
{
|
|
|
- return Ok(JsonView(true, $"限流测试 - IP:{HttpContext.Connection.RemoteIpAddress?.ToString()}", null, GetRequestCount()));
|
|
|
+ return Ok(JsonView(true, $"限流测试 - IP:{HttpContext.Connection.RemoteIpAddress?.ToString()}", "", GetRequestCount()));
|
|
|
}
|
|
|
|
|
|
private static int _requestCount = 0;
|