Request not reaching to the controller but still get 200 response

前端 未结 2 1028
一整个雨季
一整个雨季 2021-01-24 04:22

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

2条回答
  •  被撕碎了的回忆
    2021-01-24 05:14

    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.

提交回复
热议问题