protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, CustomAuthoRequire requirement)
        {
            try
            {
                var jwtToken  = _authozirationUtility.GetRequestAccessToken(context);
                var type      = jwtToken.GetClaimValue(JwtRegisteredClaimNames.Typ.ToString());
                var userRoles = RoleHandle.GetRoles(type);

                var currentAcceptRoles = userRoles.Select(x => (int)x).FirstOrDefault(y => requirement.AppceptUserTypes.Select(z => (int)z).Contains(y));

                if (currentAcceptRoles > 0)
                {
                    context.Succeed(requirement);
                }
                else
                {
                    context.Fail();
                }

                return(Task.FromResult(0));
            }
            catch
            {
                context.Fail();
                return(Task.FromResult(0));
            }
        }
 public CustomAuthoRequire(string policyName = "")
 {
     this.AppceptUserTypes = new List <UserTypeEnum>()
     {
         UserTypeEnum.Administrator
     };
     AppceptUserTypes.AddRange(RoleHandle.GetRoles(policyName));
 }