Wednesday, August 8, 2012

OAuth 2.0 Playground with WSO2 Identity Server

WSO2 Identity Server adds OAuth 2.0 support from it's very next release. Hopefully by the end of this August. OAuth Core specification supports four grant types.

1. Authorization Code Grant (authorization_code)
2. Implicit Grant
3. Resource Owner Password Credentials Grant (password)
4. Client Credentials Grant (client_credentials)

First you need to setup the sample web app. You can download it from here and host it in Tomcat. I assume it runs at http://localhost:8080/playground. If the Identity Server is not running on 9443 - then you need to edit the web.xml of the web app appropriately.

Then you need to download the WSO2 Identity Server 4.0.0 server from here.

1. Start the server
2. Login with admin/admin
3. Main/Manage/OAuth/Register New Application




4. Select OAuth 2.0
5. Give an Application Name and any Callback Url. For the sample to work, it should be http://localhost:8080/playground/oauth2client



6. Once you click on "Add" you will be taken to the OAuth Management page
7. Click on the application you just created.



8. Copy the values of Client Id, Client Secret, Access Token Url and Authorie Url -- we need these values later during different stages in the web app.



That's it. We are done. Now go to the web app... http://localhost:8080/playground.

Authorization Grant Type : Select one of the four as per the OAuth spec.
Client Id : Client Id from the above image.
Client Secret : Client Secret from the above image.
Resource Owner User Name : Any valid user name from WSO2 IS.
Resource Owner Password : Password correponding to "Resource Owner User Name".
Scope : By default can be anything. No validation. You can override the functionality if needed.
Authorize Endpoint : Authorize Url from the above image.
Access Token Endpoint : Access Token Url from the above image.


Click on import photos... Then you can execute the OAuth flow by selecting the Grant Type you want.









You can download the complete code of sample web application from here.

From the root level type "mvn clean install" to build it.

15 comments:

vujin said...

when i click on GetPhotos, playground (oauth2.jsp) give me this error:
javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Pepito said...

How can I customize the user interface of this page?

http://1.bp.blogspot.com/-4ECR3imJoPw/UCMZQ4L24MI/AAAAAAAAA-A/YzicbxFlTQI/s640/Screen+Shot+2012-08-09+at+7.23.25+AM.png

thanks!!

Malaka Silva said...

when i click on GetPhotos, playground (oauth2.jsp) give me this error:
javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Pocha huntas said...

I am informing you all "fabulous information"park equipment

Barbara amsel said...

I have never ever got this type of informative and easy contents yet I enjoyed reading these.bubblegum casting

Sreekanthreddy said...

when I clicked on Get Photos, play groud give me the error :::
org.apache.axis2.databinding.ADBException: Unexpected subelement {http://dto.oauth2.identity.carbon.wso2.org/xsd}authorizationContextToken

Zen Gamer said...

I am getting the same issue. Any solved the below problem yet?
org.apache.axis2.databinding.ADBException: Unexpected subelement {http://dto.oauth2.identity.carbon.wso2.org/xsd}authorizationContextToken

Roney Wilson said...

I continuously continue coming to your website once more simply in case you have posted new contents.full coverage insurance on car

Mickey James said...

Continue the good work; keep posting more n more n more.online cash advance lenders

Dr.Jones Methews said...

Continue the good work; keep posting more n more n more. can new yorkers still get payday loans

sowmya jonnala said...

We have tried the Playground app. Have couple of questions

1. Instead of using default admin/admin credentials we would like the credentials to be authenticated with our AuthService.
2. Please let us know how we can invoke our auth service (REST api) from Identity server.

Thanks in advance

hường lê said...

We are really grateful for your blog post. You will find a lot of approaches after visiting your post. Great work.

Such a very useful article. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article.
Sign in to Gmail to access to all Gooogle services. Log in to your account or sign up to create a new account
gmail sign in

gmail log in

what's gmail?

In this game, you start at the cavern men's age, then evolve! There is a total of 5 ages, each with its units and turrets. Take control of 16 different units and 15 different turrets to defend your base and destroy your enemy.
age of war

We are really grateful for your blog post. You will find a lot of approaches after visiting your post. Great work.
happy wheels

strike force heroes

earn to die

Fireboy and Watergirl arrived again to the temple in the forest. 2 players together can help them to find their way out.
fireboyandwatergirl

Angel said...

This is also a very good post which I really enjoy reading. It is not everyday that I have the possibility to see something like this.Angel Investor in India

Alice Denny said...

Welcomes to google terminal keep sharing such ideas in the future as well.
google snake this was actually EARN TO DIE
what i was looking for,and i am glad to came here! AGE OF WAR 2
Hi! I’ve been reading your blog for a while HAPPY WHEELS
I want you to thank for your time of this wonderful read!!! Slitherio
Amazing insight you have on this, Slither io This article always blew me BIG FARM

Fangyaya said...

lebron 13 shoes
oakley sunglasses wholesale
louis vuitton outlet
cheap true religion jeans
gucci outlet
jordan 3 retro
nfl jerseys
true religion outlet
celine outlet
gucci handbags
air jordan 8
cheap air jordans
michael kors uk
louis vuitton outlet online
adidas yeezy
michael kors outlet online
rolex watches
christian louboutin pas cher
the north face jackets
cheap ray ban sunglasses
rolex watches
adidas nmd
asics running shoes
burberry sale
michael kors outlet
louis vuitton outlet stores
coach factory outlet
air jordan shoes
christian louboutin shoes
polo shirts
louis vuitton handbags
jordans for sale
jordan 3 powder blue
rolex submariner price
adidas outlet store
cheap jordans
michael kors outlet clearance
coach outlet store online
cheap true religion jeans
lebron 13 shoes
20168.1chenjinyan