diff --git a/ApiGateway/ApiGateway.csproj b/ApiGateway/ApiGateway.csproj index fd9cda9..9715a9a 100644 --- a/ApiGateway/ApiGateway.csproj +++ b/ApiGateway/ApiGateway.csproj @@ -15,6 +15,7 @@ + diff --git a/ApiGateway/CustomLogic.cs b/ApiGateway/CustomLogic.cs index ce78d8c..238da94 100644 --- a/ApiGateway/CustomLogic.cs +++ b/ApiGateway/CustomLogic.cs @@ -1,4 +1,5 @@ -using Microsoft.IdentityModel.Tokens; +using Microsoft.Extensions.FileSystemGlobbing.Internal; +using Microsoft.IdentityModel.Tokens; using Ocelot.Configuration; using Ocelot.Middleware; using Security; @@ -23,8 +24,8 @@ namespace ApiGateway //var route2 = ctx.Items.DownstreamRequest(); //Solo el path del request //var route3 = ctx.Items.DownstreamRoute(); //Datos full del request - //var loggerFactory = LoggerFactory.Create(builder => builder.AddConsole().AddEventLog()); - //var logger = loggerFactory.CreateLogger("Auth"); + var loggerFactory = LoggerFactory.Create(builder => builder.AddConsole().AddEventLog()); + var logger = loggerFactory.CreateLogger("Auth"); //TODO: ELIMINAR ESTAS RUTAS POR COMPLETO! // TknCambioClave @@ -33,6 +34,7 @@ namespace ApiGateway string calledUrl = ctx.Items.DownstreamRoute().UpstreamPathTemplate.OriginalValue; + logger.LogError(71, $"DownstreamRoute: {calledUrl}"); // Excepcion para login, no requiere token if ( String.Equals(calledUrl, "/ldap/Conectar") || @@ -41,9 +43,25 @@ namespace ApiGateway String.Equals(calledUrl, "/Auth/CambiarClave") || String.Equals(calledUrl, "/Auth/TknCambioClave") || String.Equals(calledUrl, "/Auth/Proveedor") || - String.Equals(calledUrl, "/Email") + String.Equals(calledUrl, "/Email") || + String.Equals(calledUrl, "/Formularios/Graficas/{rutaGrafica}") ) + { return true; + } + + // Define the regular expression pattern + //string patternGraficosHc = @"^\/Formularios\/Graficas\/[A-Za-z0-9]+\.[A-Za-z]+$"; + //Regex regex = new Regex(patternGraficosHc); + //bool isMatch = regex.IsMatch(calledUrl); + + + //logger.LogError(71, $"isMatch: {isMatch}"); + + //if (isMatch) + //{ + // return true; + //} try diff --git a/ApiGateway/Routes/ocelot.historiaclinica.json b/ApiGateway/Routes/ocelot.historiaclinica.json index d001108..2bf89f7 100644 --- a/ApiGateway/Routes/ocelot.historiaclinica.json +++ b/ApiGateway/Routes/ocelot.historiaclinica.json @@ -198,6 +198,42 @@ "POST" ] }, + { + "SwaggerKey": "MsHistoriaClinica", + "UpstreamPathTemplate": "/Formularios/Graficas", + "DownstreamPathTemplate": "/Formularios/Graficas", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "localhost", + "Port": 8154 + } + ], + "RouteClaimsRequirement": { + "permisos": "any" + }, + "UpstreamHttpMethod": [ + "GET" + ] + }, + { + "SwaggerKey": "MsHistoriaClinica", + "UpstreamPathTemplate": "/Formularios/Graficas/{rutaGrafica}", + "DownstreamPathTemplate": "/Formularios/Graficas/{rutaGrafica}", + "DownstreamScheme": "http", + "DownstreamHostAndPorts": [ + { + "Host": "localhost", + "Port": 8154 + } + ], + "RouteClaimsRequirement": { + "permisos": "any" + }, + "UpstreamHttpMethod": [ + "GET" + ] + }, { "SwaggerKey": "MsHistoriaClinica", "UpstreamPathTemplate": "/GrupoEtPorRia", diff --git a/Microservicios/IntegradorBE/Properties/launchSettings.json b/Microservicios/IntegradorBE/Properties/launchSettings.json index 20b9edb..e43b43e 100644 --- a/Microservicios/IntegradorBE/Properties/launchSettings.json +++ b/Microservicios/IntegradorBE/Properties/launchSettings.json @@ -1,24 +1,14 @@ -{ - "$schema": "https://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:18821", - "sslPort": 44327 - } - }, +{ "profiles": { "IntegradorBE": { "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": false, "launchUrl": "swagger", - "applicationUrl": "https://localhost:7082;http://localhost:5082", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", "MySecretKey": "_ll@v3Segur1d4d!123" - } + }, + "dotnetRunMessages": true, + "applicationUrl": "https://localhost:7082;http://localhost:5082" }, "IIS Express": { "commandName": "IISExpress", @@ -28,5 +18,14 @@ "ASPNETCORE_ENVIRONMENT": "Development" } } + }, + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:61372/", + "sslPort": 44333 + } } -} +} \ No newline at end of file