I am not used to working with Spring Security. I have been trying the below code;
http.authorizeRequests()
.antMatchers("/health", "/info")
.access("hasIpAddress('X.X.X.X') or hasIpAddress('Y.Y.Y.Y')")
I want to allow some of my endpoints to all users like /health
or /info
from Spring and want to restrict other endpoints to requests from a few IP only. I tried something like above, but it didn't work. How to achieve, if possible, what I am trying to do with Spring Security
?