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.


vujin said...

when i click on GetPhotos, playground (oauth2.jsp) give me this error: Connection has been shutdown: PKIX path building failed: unable to find valid certification path to requested target

Pepito said...

How can I customize the user interface of this page?


Malaka Silva said...

when i click on GetPhotos, playground (oauth2.jsp) give me this error: Connection has been shutdown: PKIX path building failed: 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 {}authorizationContextToken

Zen Gamer said...

I am getting the same issue. Any solved the below problem yet?
org.apache.axis2.databinding.ADBException: Unexpected subelement {}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 cash advance lenders

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

caiyan said...

kobe shoes
hollister kids
ugg outlet
ugg outlet
polo outlet
converse trainers
canada goose outlet
longchamp uk
nike free flyknit
cheap oakleys

chenmeinv0 said...

adidas yeezy
thunder jerseys
knicks jerseys
kate spade outlet
hilfiger jeans
ray ban sunglasses
uggs outlet
ralph lauren kids
hollister outlet
ugg pas cher

chenmeinv0 said...

christian louboutin outlet
true religion outlet
michael kors outlet
burberry scarf
coach outlet store online
cheap jordan shoes
pandora charms
nike air max 2017
coach outlet store online
ferragamo outlet

raybanoutlet001 said...

louboutin shoes
nike huarache
yeezy shoes
mont blanc outlet
ed hardy uk
michael kors handbags
ugg boots
oakley sunglasses
ugg boots
coach outlet online