@Test public void testShouldApplyFalseMissingCookie() throws JOSEException { JwtAuthenticationProperties properties = createTestProperties(); JwtAuthenticationFilter filter = new JwtAuthenticationFilter(properties, null, null); Cookie cookie = createMock(Cookie.class); expect(cookie.getName()).andReturn("some-other-cookie").atLeastOnce(); HttpServletRequest request = createMock(HttpServletRequest.class); expect(request.getCookies()).andReturn(new Cookie[]{cookie}); replay(request, cookie); Assert.assertFalse(filter.shouldApply(request)); verify(request, cookie); }
@Override public boolean shouldApply(HttpServletRequest httpServletRequest) { boolean shouldApply = false; if (jwtProperties != null) { String serializedJWT = getJWTFromCookie(httpServletRequest); shouldApply = (serializedJWT != null && isAuthenticationRequired(serializedJWT)); } return shouldApply; }
JwtAuthenticationFilter implements AmbariAuthenticationFilter { @Override public boolean shouldApply(HttpServletRequest httpServletRequest) { boolean shouldApply = false; if (jwtProperties != null) { String serializedJWT = getJWTFromCookie(httpServletRequest); shouldApply = (serializedJWT != null && isAuthenticationRequired(serializedJWT)); } return shouldApply; } }
JwtAuthenticationFilter implements AmbariAuthenticationFilter { @Override public boolean shouldApply(HttpServletRequest httpServletRequest) { boolean shouldApply = false; if (jwtProperties != null) { String serializedJWT = getJWTFromCookie(httpServletRequest); shouldApply = (serializedJWT != null && isAuthenticationRequired(serializedJWT)); } return shouldApply; } JwtAuthenticationFilter(Configuration configuration, AuthenticationEntryPoint entryPoint, Users users);  JwtAuthenticationFilter(JwtAuthenticationProperties jwtProperties, AuthenticationEntryPoint entryPoint,
                                 Users users); }
JwtAuthenticationFilter implements AmbariAuthenticationFilter { @Override public boolean shouldApply(HttpServletRequest httpServletRequest) { boolean shouldApply = false; if (jwtProperties != null) { String serializedJWT = getJWTFromCookie(httpServletRequest); shouldApply = (serializedJWT != null && isAuthenticationRequired(serializedJWT)); } return shouldApply; } JwtAuthenticationFilter(Configuration configuration, AuthenticationEntryPoint entryPoint, Users users);  JwtAuthenticationFilter(JwtAuthenticationProperties jwtProperties, AuthenticationEntryPoint entryPoint,
                                 Users users); @Override boolean shouldApply(HttpServletRequest httpServletRequest); @Override void init(FilterConfig filterConfig); @Override void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain); @Override void destroy(); }
JwtAuthenticationFilter implements AmbariAuthenticationFilter { @Override public boolean shouldApply(HttpServletRequest httpServletRequest) { boolean shouldApply = false; if (jwtProperties != null) { String serializedJWT = getJWTFromCookie(httpServletRequest); shouldApply = (serializedJWT != null && isAuthenticationRequired(serializedJWT)); } return shouldApply; } JwtAuthenticationFilter(Configuration configuration, AuthenticationEntryPoint entryPoint, Users users);  JwtAuthenticationFilter(JwtAuthenticationProperties jwtProperties, AuthenticationEntryPoint entryPoint,
                                 Users users); @Override boolean shouldApply(HttpServletRequest httpServletRequest); @Override void init(FilterConfig filterConfig); @Override void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain); @Override void destroy();  }