@Override
    public void filter(ContainerRequestContext requestContext) throws IOException {
        final Optional<String> header = getBearerHeader(requestContext);
        if (header.isEmpty()) {
            // no JWT token, we'll fail immediately
            abortRequest(requestContext);
        } else {
            final String token = header.map(h -> h.replaceFirst(AUTHENTICATION_SCHEME + " ", "")).get();
            try {
                verifyToken(token);
            } catch (TokenVerificationException e) {
                LOG.error("Failed to verify auth token", e);
                abortRequest(requestContext);
            }
        }
    }
@Test
    void verifyInvalidToken() throws IOException {
        final String generationKey = "gTVfiF6A0pB70A3UP1EahpoR6LId9DdNadIkYNygK5Z8lpeJIpw9vN0jZ6fdsfeuV9KIg9gVLkCHIPj6FHW5Q9AvpOoGZO3h";
        final String verificationKey = "n51wcO3jn8w3JNyGgKc7k1fTCr1FWvGg7ODfQOyBT2fizBrCVsRJg2GsbYGLNejfi3QsKaqJgo3zAWMuAZhJznuizHZpv92S";
        final JwtTokenAuthFilter validator = new JwtTokenAuthFilter(verificationKey);

        final ContainerRequest mockedRequest = mockRequest("Bearer " + generateToken(generationKey));
        validator.filter(mockedRequest);
        Mockito.verify(mockedRequest, atLeastOnce()).abortWith(Mockito.any());
    }