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