Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7651223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:27:07+00:00 2026-05-31T11:27:07+00:00

I have a REST api written with JAX-RS, and I need to add authentication

  • 0

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 via spring, 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?

I’m using tomcat6 and jersey, if that matters.

Something like:

@Path("api")
public class Api {
    @GET
    @AuthenticationRequired
    public Response getInfo(...) {...}
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T11:27:08+00:00Added an answer on May 31, 2026 at 11:27 am

    I think you want import javax.annotation.Security.RolesAllowed;

    The annotation itself looks like this

    @Path("/helloworld")
    @RolesAllowed({"ADMIN", "ORG1"})
    public class helloWorld {
    
    @GET
    @Path("sayHello")  
    @Produces("text/plain")
    @RolesAllowed("ADMIN")
    public String sayHello() {
       return "Hello World!";
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been given some basic documentation of the RazorGator REST API and need
I have written a simple REST API in WCF, and the authentication mechanism uses
im trying to send rest api Users.getLoggedInUser i have all the secret session and
I have a REST API written in PHP located on Apache server. It takes
We have a Rest API that requires client certificate authentication. The API is used
I have been trying to connect to the Salesforce REST API but am not
I have a scenario in which I have REST API which manages a Resource
We have a REST API which clients routinely POST and PUT data to. When
We have a REST API where clients can supply parameters representing values defined on
We are trying to implement a REST API for an application we have now.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.