Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I recently built a RESTful service using Jersey and is currently used by 3 other systems internal to the network (not people).

  1. How can I make sure the requests to the service are honored only based on hostname/IP address.
  2. The service is local to the network and so Im not using HTTPS
  3. Any opensource ideas/example code would be of great help.


share|improve this question
Maybe a firewall on the server itself? – smcg Jun 26 '12 at 17:18

You could just write a simple Servlet Filter that extracts IP address from the request and accepts it or denies and terminates any further processing.

See an example -

However i think that such kind of authentication should be done before the application - by an application server or a firewall.

share|improve this answer
up vote 0 down vote accepted

There were a couple of suggestions and ideas that I tried. Eventually we decided to settle with Service based authentication. OAUTH2 was recommended by other experts and we implemented it successfully with Token based authentication using Referrer URLs and Scope. Thanks everyone for the suggestions.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.