/user/info不再需要simapiauth,/auth/check去除
This commit is contained in:
@@ -9,13 +9,6 @@ using static SimApiError;
|
|||||||
|
|
||||||
public class SimApiAuthController(SimApiAuth auth) : SimApiBaseController
|
public class SimApiAuthController(SimApiAuth auth) : SimApiBaseController
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// 获取已登录用户信息
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost, SimApiAuth, SimApiDoc("认证", "获取已登录用户信息")]
|
|
||||||
public SimApiLoginItem UserInfo() => LoginInfo;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 退出登陆
|
/// 退出登陆
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using SimApi.Attributes;
|
using SimApi.Attributes;
|
||||||
|
using SimApi.Communications;
|
||||||
using SimApi.Helpers;
|
using SimApi.Helpers;
|
||||||
using static SimApi.Helpers.SimApiError;
|
using static SimApi.Helpers.SimApiError;
|
||||||
|
|
||||||
@@ -17,7 +18,7 @@ public class SimApiCommonController : SimApiBaseController
|
|||||||
[ApiExplorerSettings(IgnoreApi = true)]
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
public void ExceptionHandler(int code)
|
public void ExceptionHandler(int code)
|
||||||
{
|
{
|
||||||
SimApiError.Error(code);
|
Error(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -32,13 +33,9 @@ public class SimApiCommonController : SimApiBaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 检测用户登陆的控制器
|
/// 获取已登录用户信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost, SimApiAuth, SimApiDoc("认证", "检测登陆")]
|
[HttpPost("/user/info"), SimApiAuth, SimApiDoc("认证", "获取已登录用户信息")]
|
||||||
public string CheckLogin()
|
public SimApiLoginItem UserInfo() => LoginInfo;
|
||||||
{
|
|
||||||
ErrorWhenNull(LoginInfo, 401, "未登录");
|
|
||||||
return LoginInfo.Id;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -426,23 +426,10 @@ public static class SimApiExtensions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.MapControllerRoute(name: "CheckLogin", pattern: "/auth/check",
|
|
||||||
defaults: new
|
|
||||||
{
|
|
||||||
controller = "SimApiCommon",
|
|
||||||
action = "CheckLogin"
|
|
||||||
});
|
|
||||||
if (options.EnableSimApiAuth)
|
if (options.EnableSimApiAuth)
|
||||||
{
|
{
|
||||||
logger.LogInformation("开始配置SimApiAuth...");
|
logger.LogInformation("开始配置SimApiAuth...");
|
||||||
builder.UseMiddleware<SimApiAuthMiddleware>();
|
builder.UseMiddleware<SimApiAuthMiddleware>();
|
||||||
builder.MapControllerRoute(name: "GetUserInfo", pattern: "/user/info",
|
|
||||||
defaults: new
|
|
||||||
{
|
|
||||||
controller = "SimApiAuth",
|
|
||||||
action = "UserInfo"
|
|
||||||
});
|
|
||||||
|
|
||||||
builder.MapControllerRoute(name: "Logout", pattern: "/auth/logout",
|
builder.MapControllerRoute(name: "Logout", pattern: "/auth/logout",
|
||||||
defaults: new
|
defaults: new
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user