Reputation: 257
is there a way to block REST API calls to a non authorized client? is there a way to make the API "limited" to (public for) only small number of well defined clients?
thanks :-)
Upvotes: 1
Views: 5356
Reputation: 7243
You just need to implement security mechanisms in your RESTful Service, so it denies access to unauthorized clients (with a 404 or 401 response code). There are several ways to achieve this:
Upvotes: 1
Reputation: 5603
If you are using RESTFul HTTP
you can add an HttpServletFilter to your web.xml which prevents unauthorized clients from accessing your REST Methods.
See Securing JAX-RS and RESTeasy
If you use the Spring Framework you and you don't want to implement your own HttServletFilter you can use Spring Security
Upvotes: 1
Reputation:
You can deploy mutually-authenticated SSL between your clients and your server. You can use self-signed certificates here so you don't need to buy any from a CA. This will ensure that your server only accepts requests from clients that have the client-side certificate (configure your server to only accept the self-signed client certificates deployed on your clients for client authentication).
Upvotes: 2