瀏覽代碼

token plugin

fly 2 年之前
父節點
當前提交
c824bde284
共有 1 個文件被更改,包括 43 次插入1 次删除
  1. 43 1
      src/Plugin/TokenVerifyPluginService.cs

+ 43 - 1
src/Plugin/TokenVerifyPluginService.cs

@@ -26,11 +26,53 @@ namespace WingCloudServer.Plugin
             _authenticationService = GetProxy<IAuthenticationService>();
         }
 
+        /// <summary>
+        /// 不需要token验证的接口列表
+        /// </summary>
+        /// <value></value>
+        public static List<string> NotValidationRequiredList = new List<string>
+        {
+            "IConnectService/ConnectAsync",
+            "IEmailService/SendEmailAsync",
+            "ILoginService/CommonLoginAsync",
+            "ILoginService/CheckLoginTypeAsync",
+            "ILoginService/CommonSignUpAsync",
+            "ILoginService/CheckSMSVerificationCodeAsync",
+            "ILoginService/SendSMSVerificationCodeAsync",
+            "ILoginService/SendEmailVerificationCodeAsync",
+            "ILoginService/CheckEmailVerificationCodeAsync",
+            "ILoginService/RetrievePasswordByPhoneAsync",
+            "ILoginService/RetrievePasswordByEmailAsync",
+            "ILoginService/VerifyAccountAsync",
+            "IManagementService/AdminLogin",
+            "IManagementService/FindReportPreviewUrlAsync",
+            "IManagementService/FindReportShareConentAsync",
+            "IManagementService/FindRelatedDeviceCodesAsync",
+            "IManagementService/AddReportTemplateAsync",
+            "IManagementService/UpdateReportTemplateAsync",
+            "IManagementService/RemoveReportTemplateAsync",
+            "IManagementService/GetReportTemplateAsync",           
+            "IRemedicalService/GetReportElementByLanguageAsync",
+            "IRemedicalService/PushFinshExamNotificationToClientAsync",
+            "INotificationService/SendMessageAsync",
+            "INotificationService/PostMessageAsync",
+            "IRegionService/GetRegionsAsync",
+            "IReportService/FindShareContentAsync",
+            "ISMSService/SendMessageAsync",
+            "ISMSService/CheckVerificationCodeAsync",
+            "ISMSService/GeneralMessageAsync",
+            "IStorageService/UploadFileAsync",
+            "IVinnoServerService/UpdateServerInfoAsync",
+            "IVinnoServerService/GetServerInfoListAsync",
+            "IVinnoServerService/EchoAsync"
+        };
+
         public PluginProcessResult PreProcess(IJsonRpcHttpContext context, byte[] requestData)
         {
             var dataLength = (int)context.GetRequestContentLength();
             var requests = JsonRpcCodec.DecodeRequestsAsync(requestData, new System.Threading.CancellationToken(), dataLength).Result;
-            if (context.GetRequestPath() == "/IUserService" && requests[0].Method == "GetUserInfoAsync")
+            var apiName = $"{context.GetRequestPath().Trim('/')}/{requests[0].Method.Trim('/')}";
+            if (context.GetRequestPath() != "/IAuthenticationService" && !NotValidationRequiredList.Contains(apiName))
             {
                 var tokenRequest = JsonConvert.DeserializeObject<List<ValidateTokenRequest>>(requests[0].Params.Value.ToString().Replace("\r", "").Replace("\n", "").Replace("\t", ""));
                 var result = _authenticationService.ValidateTokenAsync(tokenRequest[0]).Result;