diff --git a/Auth/Security.cs b/Auth/Security.cs index c298c8b..45ded06 100644 --- a/Auth/Security.cs +++ b/Auth/Security.cs @@ -11,6 +11,7 @@ namespace Security public static string? HashKey { get; private set; } private static string? PwdKey { get; set; } + // private static readonly HttpClient client = new(); public Encripter() { string? mode = Environment.GetEnvironmentVariable("Mode"); @@ -164,6 +165,19 @@ namespace Security return Base64Encode(encryptedText); } + public static string Descypher(string value) + { + string b64Decrypted = Base64Decode(value); + string decryptedText = ""; + for (int i = 0; i < b64Decrypted.Length; i++) + { + int encrypted = (int)b64Decrypted[i]; + int decryption = encrypted - _SEMILLA; + decryptedText += Char.ConvertFromUtf32(decryption); + } + return decryptedText; + } + public static string Base64Decode(string base64EncodedData) { diff --git a/Microservicios/IntegradorBE/IntegradorBE.csproj b/Microservicios/IntegradorBE/IntegradorBE.csproj index 36ecd2d..a35afe2 100644 --- a/Microservicios/IntegradorBE/IntegradorBE.csproj +++ b/Microservicios/IntegradorBE/IntegradorBE.csproj @@ -12,7 +12,7 @@ - + diff --git a/Microservicios/MsUsuarios/Controllers/AuthController.cs b/Microservicios/MsUsuarios/Controllers/AuthController.cs index b4d29e8..f3c25df 100644 --- a/Microservicios/MsUsuarios/Controllers/AuthController.cs +++ b/Microservicios/MsUsuarios/Controllers/AuthController.cs @@ -83,6 +83,8 @@ namespace MSAdminUsuarios.Controllers { try { + #warning este metodo se debe revisar, des-encriptado no se debe permitir! + JwtSecurityTokenHandler handler = new(); JwtSecurityToken tkn = handler.ReadJwtToken(Encripter.Descypher(token)); int pk = Int32.Parse(tkn.Claims.FirstOrDefault(c => c.Type == "pk").Value); diff --git a/Microservicios/MsUsuarios/MSAdminUsuarios.csproj b/Microservicios/MsUsuarios/MSAdminUsuarios.csproj index 8566351..37906ce 100644 --- a/Microservicios/MsUsuarios/MSAdminUsuarios.csproj +++ b/Microservicios/MsUsuarios/MSAdminUsuarios.csproj @@ -19,7 +19,7 @@ - +