From f7e1b9be2a79fc99c28e49eb546c6bdb450c3740 Mon Sep 17 00:00:00 2001 From: xRain Date: Wed, 11 Nov 2020 03:28:09 +0800 Subject: [PATCH] complete with .net core 5.0.0 --- Attributes/SimApiAuthAttribute.cs | 9 +++++++++ SimApi.csproj | 9 +++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Attributes/SimApiAuthAttribute.cs b/Attributes/SimApiAuthAttribute.cs index 3d4a125..b4458b0 100644 --- a/Attributes/SimApiAuthAttribute.cs +++ b/Attributes/SimApiAuthAttribute.cs @@ -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"]; diff --git a/SimApi.csproj b/SimApi.csproj index a45a364..d5c6d6f 100644 --- a/SimApi.csproj +++ b/SimApi.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1 + net5.0 Library true 0.2.3 @@ -11,10 +11,11 @@ true snupkg true - 1.1.1 + 5.0.0 false + @@ -24,8 +25,8 @@ - - + +