I was playing around spring security and trying to secure an restful application, but then ran into this rather absurd problem. All the action on my controllers are fine and the
You must pass on the request on to the chain and you don't in case (header != null && headerContainsprefix)
After struggling some time I found the problem. It was indeed a stupid mistake that I made. and it was on the Authorization filter. changed
if (null != header) {
final var headerContainsPrefix = header.startsWith(TOKEN_PREFIX);
if (!headerContainsPrefix) {
chain.doFilter(request, response);
return;
}
return;
}
to :
if (null != header) {
final var headerContainsPrefix = header.startsWith(TOKEN_PREFIX);
if (!headerContainsPrefix) {
chain.doFilter(request, response);
return;
}
}
and seems to solve the problem.