网关添加忽略路径配置

usertest
cjy 4 months ago
parent f6cf42103f
commit d5bbb33f5e

@ -1,4 +1,5 @@
using DS.Module.Core;
using System.Security.Policy;
namespace DS.WMS.Gateway;
@ -20,9 +21,12 @@ public class JwtSafeMiddleware
if (context.Request.Method == "GET" || context.Request.Method == "POST")
{
var ignoreUrl = AppSetting.app(new string[] { "Cors", "IgnorePath" });
// Console.WriteLine(context.Request.Path);
var path = context.Request.Path.ToString().ToLower();
if (path.Contains("swagger") || path.Contains("login")|| path.Contains("tenantregister") || path.Contains("linkattach") || path.Contains("printtempfile") || path.Contains("favicon") || path.Contains("clientuserlogin") )
if(ignoreUrl.Split(",", StringSplitOptions.RemoveEmptyEntries).ToArray().Contains(path))
//if (path.Contains("swagger") || path.Contains("login")|| path.Contains("tenantregister") || path.Contains("linkattach") || path.Contains("printtempfile")
// || path.Contains("favicon") || path.Contains("clientuserlogin") || path.Contains("addbookingstatuslog"))
{
//跳过swagger及login
}

@ -8,7 +8,8 @@
"AllowedHosts": "*",
"Cors": {
"PolicyName": "WMSCore.API",
"Url": "http://localhost:3110,https://localhost:3110,http://localhost:3112,https://localhost:3112"
"Url": "http://localhost:3110,https://localhost:3110,http://localhost:3112,https://localhost:3112",
"IgnorePath": "swagger,login,tenantregister,linkattach,printtempfile,favicon,clientuserlogin,addbookingstatuslog"
},
"JwtSettings": {
"Issuer": "vol.core.owner",

@ -1,6 +1,7 @@
using DS.Module.Core;
using DS.WMS.Core.Op.Dtos;
using DS.WMS.Core.Op.Interface;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace DS.WMS.OpApi.Controllers
@ -28,6 +29,7 @@ namespace DS.WMS.OpApi.Controllers
/// <returns></returns>
[HttpPost]
[Route("AddBookingStatusLog")]
[AllowAnonymous]
public async Task AddBookingStatusLog([FromBody]List<BookingStatusLogReq> req)
{
await _invokeService.AddBookingStatusLog(req);

Loading…
Cancel
Save