Click here to Skip to main content
15,920,217 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Do you have some token based authentication for RESTEasy APIs. I want to design some REST API URL for login and logout. On upon calling login URL with valid user name and password, the server will assign token to response header. For subsequent API call the client has to send the token to the server. Also the token has some expiery. Is there any some existing framework available? If yes then can you write one example like above? if not then how do I integrate it?

What I have tried:

i tried this link but i am facing the problem like The import org.glassfish.jersey.client cannot be resolved.I have already included all jar files.
Updated 7-Jul-16 2:23am

1 solution

You can implement the OAuth provider service in Java on your server side, and then use it on the client side as the authentication. This authentication system (OAuth) is what you are looking for (or are thinking about).

The service is very much simple and straight-forward, and the standard explains how to do that. If you are willing to read about that standard, please go here,[^]. I don't do that much Java programming, but here you go:

Is there an OAuth 2.0 Provider implementation in Java? (not oauth client) - Stack Overflow[^]
Code — OAuth[^] (Have a look at the Java section)
GitHub - OAuth-Apis/apis: OAuth Authorization as a Service[^]

The GitHub samples provide the samples for both, server as well as client. You can download the source code and run them as you want.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900