using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Nirvana.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Waste.Web.Entry
{
    /// <summary>
    /// 验证登录
    /// </summary>
    public class HandlerLogin : Attribute, IAsyncAuthorizationFilter
    {
        public Task OnAuthorizationAsync(AuthorizationFilterContext context)
        {
            if (OperatorProvider.Provider.GetCurrent() == null)
            {
                context.Result = new RedirectResult("/Login");
            }
            return Task.CompletedTask;
        }
    }
}
