private List <Claim> BuildDataClaims(string userId, CalcDataKey dataKeyCalc) { var claims = new List <Claim> { new Claim(DataAuthConstants.HierarchicalKeyClaimName, dataKeyCalc.CalcDataKeyForUser(userId)) }; return(claims); }
protected override async Task <ClaimsIdentity> GenerateClaimsAsync(IdentityUser user) { var identity = await base.GenerateClaimsAsync(user); var userId = identity.Claims.SingleOrDefault(x => x.Type == ClaimTypes.NameIdentifier)?.Value; var rtoPCalcer = new CalcAllowedPermissions(_extraAuthDbContext); identity.AddClaim(new Claim(PermissionConstants.PackedPermissionClaimType, await rtoPCalcer.CalcPermissionsForUserAsync(userId))); var dataKeyCalcer = new CalcDataKey(_extraAuthDbContext); identity.AddClaim(new Claim(DataAuthConstants.HierarchicalKeyClaimName, dataKeyCalcer.CalcDataKeyForUser(userId))); return(identity); }
public AuthCookieValidate(CalcAllowedPermissions rtoPCalcer, CalcDataKey dataKeyCalcer, ISimpleTimeCache cache) { _rtoPCalcer = rtoPCalcer; _dataKeyCalcer = dataKeyCalcer; _cache = cache; }