Exemple #1
0
        public async Task InvokeAsync(HttpContext context, IJwtTokenSecurityService jwtTokenSerivice)
        {
            var token = context.Request.Headers["Authorization"].FirstOrDefault()?.Split(" ").Last();

            if (!string.IsNullOrEmpty(token))
            {
                bool check = jwtTokenSerivice.ValidateToken(token);
                context.Items["isValidToken"] = check;
            }
            // Call the next delegate/middleware in the pipeline
            await _next(context);
        }
 public AuthenticationService(IJwtTokenSecurityService tokenService, IERPUnitOfWork context, ILogger <AuthenticationService> logger)
 {
     _tokenService = tokenService;
     _context      = context;
     _logger       = logger;
 }