Using a custom Spring Security filter, I\'d like to return an HTTP 401 error code if the HTTP Header doesn\'t contain a particular key-value pair.
Example:
Just do as they say in the upper answer. "so setting the response status code and returning immediately" This is just type:
res.setStatus(HttpServletResponse.SC_UNAUTHORIZED); return;