I'm running a web application under Tomcat server. Different servlets are configured using Tomcat's web.xml.
I'm looking for a convenient way to restrict access to specific METHODS of specific URLS so that only these METHODS can be accessed using an Authorization
header while others can be accessed without any restriction.
For instance, for url http://localhost:8080/my/servlet1
- GET
and OPTIONS
can be accessed by any user, while POST
and PUT
must be authorized with a username and a password, but for url http://localhost:8080/my/servlet2
- all methods are open.
How can I implement that?
Thanks