Fix: Referencias al Auth
This commit is contained in:
parent
e9a8bf6069
commit
125ef8b3ea
@ -11,6 +11,7 @@ namespace Security
|
|||||||
public static string? HashKey { get; private set; }
|
public static string? HashKey { get; private set; }
|
||||||
private static string? PwdKey { get; set; }
|
private static string? PwdKey { get; set; }
|
||||||
|
|
||||||
|
// private static readonly HttpClient client = new();
|
||||||
public Encripter()
|
public Encripter()
|
||||||
{
|
{
|
||||||
string? mode = Environment.GetEnvironmentVariable("Mode");
|
string? mode = Environment.GetEnvironmentVariable("Mode");
|
||||||
@ -164,6 +165,19 @@ namespace Security
|
|||||||
return Base64Encode(encryptedText);
|
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)
|
public static string Base64Decode(string base64EncodedData)
|
||||||
{
|
{
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Auth\Auth.csproj" />
|
<ProjectReference Include="..\..\Auth\Auth.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -83,6 +83,8 @@ namespace MSAdminUsuarios.Controllers
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
#warning este metodo se debe revisar, des-encriptado no se debe permitir!
|
||||||
|
|
||||||
JwtSecurityTokenHandler handler = new();
|
JwtSecurityTokenHandler handler = new();
|
||||||
JwtSecurityToken tkn = handler.ReadJwtToken(Encripter.Descypher(token));
|
JwtSecurityToken tkn = handler.ReadJwtToken(Encripter.Descypher(token));
|
||||||
int pk = Int32.Parse(tkn.Claims.FirstOrDefault(c => c.Type == "pk").Value);
|
int pk = Int32.Parse(tkn.Claims.FirstOrDefault(c => c.Type == "pk").Value);
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Auth\Auth.csproj" />
|
<ProjectReference Include="..\..\Auth\Auth.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
Reference in New Issue
Block a user