Ejemplo n.º 1
0
 /// <summary>
 /// Makes a decision if authorization is allowed based on GroupPolicyRequirement.
 /// </summary>
 /// <param name="context"></param>
 /// <param name="requirement"></param>
 /// <returns></returns>
 protected override Task HandleRequirementAsync(AuthorizationHandlerContext context,
                                                GroupPolicyRequirement requirement)
 {
     // Calls method to check if requirement exists in user claims or session.
     if (GraphHelper.CheckUsersGroupMembership(context, requirement.GroupName, _httpContextAccessor))
     {
         context.Succeed(requirement);
     }
     return(Task.CompletedTask);
 }