class JsonWebTokenAuthFilter extends AuthFilter<String, P> {

    @Override
    public void filter(ContainerRequestContext containerRequestContext)
            throws NullPointerException, WebApplicationException {

        final String authorizationHeaderValue = containerRequestContext.getHeaderString("Authorization");

        if (authorizationHeaderValue == null)
            throw new WebApplicationException("Authorization header was not set.", 401);

        final String jwtToken = tryExtractJwtTokenFromAuthorizationHeader(authorizationHeaderValue);

        final P principal = this.tryAuthenticateUsingJwtToken(jwtToken);

        final boolean isSecure = isRequestSecure(containerRequestContext);

        final SecurityContext securityContext =
                createSecurityContext(principal, this.authorizer, isSecure);

        containerRequestContext.setSecurityContext(securityContext);
    }

}