public static boolean requestContainsJwt(HttpServletRequest request) { return extractJwt(request) != null; }
@Override protected boolean shouldProcess(HttpServletRequest request) { String jwtToken = JwtUtil.extractJwt(request); if (!StringUtils.isEmpty(jwtToken)) { try { Jwt jwt = new SimpleJwtParser().parse(jwtToken); boolean wasIssuedByHost = jwtWasIssuedByHost(jwt.getIssuer()); log.debug("wasIssuedByHost={}", wasIssuedByHost); return wasIssuedByHost; } catch (Exception e) { // one of the many possible JWT reading exceptions was thrown - log for debugging and let the invoking test fail log.error(String.format("Failed to read JWT token '%s' due to exception: ", jwtToken), e); } } log.debug("JWT token was empty: should not process request"); return false; }