using IRaCIS.Core.Infra.EFCore;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc.Filters;
using System;
using System.Collections.Generic;
using System.Linq;

namespace IRaCIS.Core.Application.BusinessFilter
{

    //public class UserTypeRequirement : IAuthorizationRequirement
    //{
    //}

    //public class UserTypeHandler : AuthorizationHandler<UserTypeRequirement>
    //{

    //    private IUserInfo _userInfo;

    //    public UserTypeHandler(IUserInfo userInfo)
    //    {
    //        _userInfo = userInfo;
    //    }


    //    protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, UserTypeRequirement requirement)
    //    {

    //        //if (context.User.Claims.Count() == 0)
    //        //{
    //        //    return Task.CompletedTask;
    //        //}

    //        //string userId = context.User.Claims.First(c => c.Type == "Userid").Value;
    //        //string qq = context.User.Claims.First(c => c.Type == "QQ").Value;

    //        //if (_UserService.Validata(userId, qq))
    //        //{
    //        //    context.Succeed(requirement); //验证通过了
    //        //}
    //        ////在这里就可以做验证

    //        return Task.CompletedTask;
    //    }
    //}
}
