private static Task<bool> VerifyClientIdAsync(ApplicationUserManager manager, ApplicationUser user, CookieValidateIdentityContext context) { string clientId = context.Identity.FindFirstValue("AspNet.Identity.ClientId"); if (!string.IsNullOrEmpty(clientId) && user.Clients.Any(c => c.Id.ToString() == clientId)) { user.CurrentClientId = clientId; return Task.FromResult(true); } return Task.FromResult(false); }
private static async Task<bool> VerifySecurityStampAsync(ApplicationUserManager manager, ApplicationUser user, CookieValidateIdentityContext context) { string stamp = context.Identity.FindFirstValue("AspNet.Identity.SecurityStamp"); return (stamp == await manager.GetSecurityStampAsync(context.Identity.GetUserId())); }