@Test public void assertPassesWithHeader() { CsrfProtectionFilter filter = new CsrfProtectionFilter(); doReturn("POST").when(mockContext).getMethod(); MultivaluedStringMap map = new MultivaluedStringMap(); map.putSingle("X-Requested-With", "Test"); doReturn(map).when(mockContext).getHeaders(); filter.filter(mockContext); }
@Override public void filter(final ContainerRequestContext request) { if (METHODS_TO_IGNORE.contains(request.getMethod())) { return; } if (request.getHeaders().containsKey(HEADER)) { return; } throw new NoCSRFHeaderException(); }
CsrfProtectionFilter implements ContainerRequestFilter { @Override public void filter(final ContainerRequestContext request) { if (METHODS_TO_IGNORE.contains(request.getMethod())) { return; } if (request.getHeaders().containsKey(HEADER)) { return; } throw new NoCSRFHeaderException(); } }
CsrfProtectionFilter implements ContainerRequestFilter { @Override public void filter(final ContainerRequestContext request) { if (METHODS_TO_IGNORE.contains(request.getMethod())) { return; } if (request.getHeaders().containsKey(HEADER)) { return; } throw new NoCSRFHeaderException(); }  }
CsrfProtectionFilter implements ContainerRequestFilter { @Override public void filter(final ContainerRequestContext request) { if (METHODS_TO_IGNORE.contains(request.getMethod())) { return; } if (request.getHeaders().containsKey(HEADER)) { return; } throw new NoCSRFHeaderException(); }  @Override void filter(final ContainerRequestContext request); }
CsrfProtectionFilter implements ContainerRequestFilter { @Override public void filter(final ContainerRequestContext request) { if (METHODS_TO_IGNORE.contains(request.getMethod())) { return; } if (request.getHeaders().containsKey(HEADER)) { return; } throw new NoCSRFHeaderException(); }  @Override void filter(final ContainerRequestContext request);  }