This blog is for the developers who is having a requirement to use WSO2IS as an authorization server. For an example, I'm going to use WSO2 Identity Server to demonstrate this use case.
Step 1 :-
Checkout a sample application from this[1] git location and build it. Take the .war file which is created inside the <SAMPLE_HOME>/oauth2/playground2/target directory and deploy it in tomcat server(Its required to be deployed on tomcat 7.x version). Build and deployment details are available in this document[2].
Service Provider Name:* playground2
You have to add a call back url for particular sample application in relevant field.
http://localhost:8080/playground2/oauth2.jsp
client secret for particular application.
Authorization Grant Type : Select a grant type from the drop down menu
Client Id : Client ID which is generated in step 2
Scope : openid
Callback URL : http://localhost:8080/playground2/oauth2client
call back url which is given when you create a service provider.
Authorize Endpoint : https://localhost:9443/oauth2/authorize
If you have configured above service provider in a tenant, you have to use tenant name as a query parameter for authorization endpoint. For an example, if you have configured service provider in
tenant (madura.com), you have to use below url for authorize endpoint.
https://localhost:9443/oauth2/authorize?tenantDomain=madura.com
user credentials. Then you will get the consent page as below.
authorization code
Callback URL : http://localhost:8080/playground2/oauth2client
Access Token Endpoint : https://localhost:9443/oauth2/token
Client Secret : client secret which you generated in step 2
When you provide above information and click on the Get Access Token button, you are able to get an access token.
Step 1 :-
Checkout a sample application from this[1] git location and build it. Take the .war file which is created inside the <SAMPLE_HOME>/oauth2/playground2/target directory and deploy it in tomcat server(Its required to be deployed on tomcat 7.x version). Build and deployment details are available in this document[2].
Step 2 :-
Download WSO2 identity server from this link[1] and create a service provider for sample application.
When you create a service provider, you need to add service provider name first and click Register
button. Once you create a service provider, you need to configure call back url for particular application.
Please click on Configure link which is defined under OAuth/OpenID Connect Configuration
box. Service Provider Name:* playground2
Once you clicked the highlighted link in above screen, you will see below screen
. You have to add a call back url for particular sample application in relevant field.
Callback Url* : http://localhost:8080/playground2/oauth2client
Step 3 :-
Start tomcat server and navigate to the playground2 application using below url.
Once you create a service provider as I explained in step 2, you will get
clientId and client secret for particular application.
Authorization Grant Type : Select a grant type from the drop down menu
Client Id : Client ID which is generated in step 2
Scope : openid
Callback URL : http://localhost:8080/playground2/oauth2client
call back url which is given when you create a service provider.
Authorize Endpoint : https://localhost:9443/oauth2/authorize
If you have configured above service provider in a tenant, you have to use tenant name as a query parameter for authorization endpoint. For an example, if you have configured service provider in
tenant (madura.com), you have to use below url for authorize endpoint.
https://localhost:9443/oauth2/authorize?tenantDomain=madura.com
Once you click on the Authorize button, You have to log in to the Identity server
by providing user credentials. Then you will get the consent page as below.
Once you click on Approve button or Approve Always button, you will get the below
screen with authorization code
Callback URL : http://localhost:8080/playground2/oauth2client
Access Token Endpoint : https://localhost:9443/oauth2/token
Client Secret : client secret which you generated in step 2
When you provide above information and click on the Get Access Token button, you are able to get an access token.
[1]https:
//github.com/wso2/product-is/tree/v5.1.0/modules/samples/oauth2/playground2
[2]https://docs.wso2.com/display/IS510/OAuth+2.0+with+WSO2+Playground
Comments
Post a Comment