26

I have created RESTful services in java/netbeans using the Jersey Library. Now i want to secure this service using oAuth 2.0.

Are there any libraries or any tutorial to achieve that? I couldn't find anything useful in google.

orak
  • 2,399
  • 7
  • 29
  • 55

3 Answers3

11

You can use Apache Oltu (formerly Apache Amber): https://cwiki.apache.org/confluence/display/OLTU/Documentation

The Authorization Server and Resource Server sections explain how to secure your REST services.

Daniel Trebbien
  • 38,421
  • 18
  • 121
  • 193
Lukasz Moren
  • 1,625
  • 2
  • 15
  • 16
  • 6
    The link only provides code snippets for servlets. They have given [Integration Tests](https://svn.apache.org/repos/asf/incubator/amber/trunk/oauth-2.0/oauth2-integration-tests/) but the link doesnot work. Any complete example code for Jersey based service? – orak Jul 21 '12 at 12:07
11

Check this example Jersey + Oltu + Oauth: https://bitbucket.org/dobromyslov/oauth2-example/src/

Explanation how it works is located here:

http://www.jasondl.ee/posts/2013/a-simple-oauth2-client-and-server-example-part-i.html

And here:

http://www.jasondl.ee/posts/2013/a-simple-oauth2-client-and-server-example-part-ii.html

Raztyck
  • 88
  • 7
Viacheslav Dobromyslov
  • 3,168
  • 1
  • 33
  • 45
2

We used spring security, think is the simple and easiest way, look here for more information:

shem
  • 4,686
  • 2
  • 32
  • 43