Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Brunobento1990 committed Aug 3, 2024
1 parent 373f72b commit 9732488
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions OpenAdm.Api/Middlewares/ParceiroMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public async Task Invoke(

parceiroAutenticado.Referer = referer;
parceiroAutenticado.StringConnection = CryptographyGeneric.Decrypt(parceiro.ConexaoDb);
parceiroAutenticado.KeyParceiro = parceiro.Id.ToString();

await _next(httpContext);
}
Expand Down
1 change: 1 addition & 0 deletions OpenAdm.Domain/Interfaces/IParceiroAutenticado.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ public interface IParceiroAutenticado
{
string StringConnection { get; set; }
string Referer { get; set; }
string KeyParceiro { get; set; }
}
6 changes: 3 additions & 3 deletions OpenAdm.Infra/Cached/Services/CachedService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class CachedService<T> : ICachedService<T> where T : class
private readonly JsonSerializerOptions _serializerOptions;
private static readonly double _absolutExpiration = 60;
private static readonly double _slidingExpiration = 30;
private readonly string _dominimo;
private readonly string _keyParceiro;

public CachedService(IDistributedCache distributedCache,
IParceiroAutenticado parceiroAutenticado)
Expand All @@ -29,7 +29,7 @@ public CachedService(IDistributedCache distributedCache,
.SetSlidingExpiration(TimeSpan.FromMinutes(_slidingExpiration));

_distributedCache = distributedCache;
_dominimo = parceiroAutenticado.Referer;
_keyParceiro = parceiroAutenticado.KeyParceiro;
}

public async Task<T?> GetItemAsync(string key)
Expand Down Expand Up @@ -74,6 +74,6 @@ private static void Valid(string key)

private string GetNewKey(string key)
{
return $"{_dominimo}-{key}";
return $"{_keyParceiro}-{key}";
}
}
1 change: 1 addition & 0 deletions OpenAdm.Infra/Model/ParceiroAutenticado.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ public class ParceiroAutenticado : IParceiroAutenticado
{
public string StringConnection { get; set; } = string.Empty;
public string Referer { get; set; } = string.Empty;
public string KeyParceiro { get; set; } = string.Empty;
}

0 comments on commit 9732488

Please sign in to comment.