예제 #1
0
 public abstract Task <(bool, JsonResult)> AuthorizeAsync(HttpContext httpContext, TokenValidResult validResult);
예제 #2
0
        public override Task <(bool, JsonResult)> AuthorizeAsync(HttpContext httpContext, TokenValidResult validResult)
        {
            if (!validResult.HasToken)
            {
                return(Task.FromResult <(bool, JsonResult)>((false, Provider.CreateNotLoginResponse(httpContext))));
            }
            if (validResult.HasExpire)
            {
                return(Task.FromResult <(bool, JsonResult)>((false, Provider.CreateTokenExpireResponse(httpContext))));
            }
            else if (!validResult.Success || httpContext.User == null)
            {
                return(Task.FromResult <(bool, JsonResult)>((false, Provider.CreateTokenErrorResponse(httpContext))));
            }

            return(Task.FromResult <(bool, JsonResult)>((true, null)));
        }