I am using spring boot and spring security for web applications. I wanted to apply for no filter on my public API. Now what I am doing is the equality check on the path which is sent by the client and the path which I have hard code if it is equal then I am not applying the filter.
Code sample
protected boolean shouldNotFilter(HttpServletRequest request) throws ServletException {
return request.getRequestURI().equals("api/v1/public/hello"));
}
But this approach is not a good way to do. As in, there can be multiple public endpoints and I can't put an equal check on each of them. I need a solution where I can have all my public endpoints in one place and when the request comes I simply have to check in that one place if it is present then no filter will be applied.