title: How can a JAX-RS REST service have authentication handled by annotations?
body: <p>I have a REST api written with JAX-RS, and I need to add authentication to it. So far all the information I've been able to find about it has suggestions for doing it <a href="https://stackoverflow.com/questions/4124831/how-to-do-rest-authentication-with-jax-rs">via spring</a>, which I'm not using. Is there something already existing, or would it be easy to write, something that will let me annotate either a method, or the entire class which would force auth headers to be present?</p>
  
  <p>I'm using tomcat6 and jersey, if that matters.</p>
  
  <p>Something like:</p>
  
  <pre><code>@Path("api")
  public class Api {
      @GET
      @AuthenticationRequired
      public Response getInfo(...) {...}
  }
  </code></pre>