private void RemoveClaimsCache() { try { ClaimsCache.Remove(CacheKeyGenerator.GetClaimsKey(Identity)); } catch (Exception ex) { Logger.Technical.From <AppPrincipalFactory>().Exception(ex).Log(); } }
// must be refactored => Take this based on a strategy based on the .Net code. private List <ClaimDto> GetClaimsFromCache(ClaimsIdentity identity) { try { var secureClaims = ClaimsCache.Get <List <ClaimDto> >(CacheKeyGenerator.GetClaimsKey(identity)); return(secureClaims ?? new List <ClaimDto>()); } catch (Exception) { return(new List <ClaimDto>()); } }
private void SaveClaimsToCache(IEnumerable <Claim> claims) { var dto = claims.Select(c => new ClaimDto(c.Type, c.Value)).ToList(); try { ClaimsCache.Put(CacheKeyGenerator.GetClaimsKey(Identity), dto); } catch (Exception ex) { Logger.Technical.From <AppPrincipalFactory>().Exception(ex).Log(); } }