complete with .net core 5.0.0

This commit is contained in:
2020-11-11 03:28:09 +08:00
parent d0fe883e74
commit f7e1b9be2a
2 changed files with 14 additions and 4 deletions
+9
View File
@@ -1,5 +1,6 @@
using System;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using SimApi.Communications;
using SimApi.Exceptions;
@@ -14,6 +15,7 @@ namespace SimApi.Attributes
{
private string[] Types { get; }
//默认是user登录类型
public SimApiAuthAttribute()
{
@@ -32,6 +34,13 @@ namespace SimApi.Attributes
Types = types;
}
//只检测一种用户类型的快捷方式
public SimApiAuthAttribute(string type, string url)
{
Types = new[] { type };
new HttpPostAttribute(url);
}
public override void OnActionExecuting(ActionExecutingContext context)
{
var loginInfo = (SimApiLoginItem)context.HttpContext.Items["LoginInfo"];