protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, RestrictAccessToDeadUsersRequirement requirement) { var currentUserLogin = context.User.Identity?.Name; if (currentUserLogin == null) { context.Fail(); return(Task.CompletedTask); } var deadUserLogins = citizenUserRepository.GetDeadUsers().Select(u => u.Login).ToList(); if (!deadUserLogins.Contains(currentUserLogin)) { context.Succeed(requirement); } else { context.Fail(); } return(Task.CompletedTask); }