I have a specific controller (among many other controllers). I would like to allow requests to this controller that are being invoked from localhost only. Whats the best way to do this?
here is the controller:
@Controller
public class LocalProvider {
@RequestMapping(value = "/someURL", method = RequestMethod.POST)
@ResponseBody
public responseDTO doSomethingForLocalRequest(@RequestBody ReqDTO reqDTO ) {
//do something
}
EDIT :
Succesffuly achieved that by adding the following to spring security.xml:
<intercept-url pattern="/someURL/*" access="hasIpAddress('127.0.0.1')" />