class AccessTokenAuthenticationFilter extends OncePerRequestFilter {

    @Override
    public void doFilterInternal(@SuppressWarnings("NullableProblems") HttpServletRequest request,
                                 @SuppressWarnings("NullableProblems") HttpServletResponse response,
                                 @SuppressWarnings("NullableProblems") FilterChain chain)
        throws IOException, ServletException {
        String token = jwtTool.getTokenFromHttpServletRequest(request);
        if (token != null) {
            try {
                Authentication authentication = authenticationManager
                    .authenticate(new UsernamePasswordAuthenticationToken(token, null));
                log.info("User successfully authenticate - {}", authentication.getPrincipal());
                SecurityContextHolder.getContext().setAuthentication(authentication);
            } catch (ExpiredJwtException e) {
                log.info("Token has expired: " + token);
            } catch (Exception e) {
                log.info("Access denied with token: " + e.getMessage());
            }
        }
        chain.doFilter(request, response);
    }

    public  AccessTokenAuthenticationFilter(JwtTool jwtTool, AuthenticationManager authenticationManager);

}