예제 #1
0
        protected override async Task HandleRequirementAsync(AuthorizationHandlerContext context,
                                                             JwtRequirement requirement)
        {
            if (await _jwtManager.CheckIfUserUsedActiveTokenAsync(context.User))
            {
                _logger.Debug($"User tried to connect with inactive token. {context.User?.Identity?.Name}");

                context.Fail();
                _httpContextAccessor.HttpContext.Response.StatusCode = 401;
            }
            else
            {
                context.Succeed(requirement);
            }
        }