This documentation is for WSO2 Identity Server 5.0.0. View documentation for the latest release.
OpenID Connect with the WSO2 Identity Server and WSO2 OAuth2 Playground - Identity Server 5.0.0 - WSO2 Documentation
||
Skip to end of metadata
Go to start of metadata

This section demonstrates the WSO2 Identity Servers OpenID Connect Basic Client Profile Implementation with the WSO2 OAuth2 Playground sample. You can download the WSO2 Identity Server from here.

Setting up WSO2 OAuth2.0 Playground sample:

  1. Checkout the playground2 sample from here using SVN.
  2. Make the following changes to the pom.xml file available in playground2 directory checked out from SVN.

    1. Comment out the parent xml element. See the following as an example.

      <!--parent>
      	<groupId>org.wso2.identity</groupId>
      	<artifactId>wso2is-identity-samples-oauth2</artifactId>
      	<version>5.0.0</version>
      	<relativePath>../pom.xml</relativePath>
      </parent-->
    2. Add the <groupId>org.wso2.identity</groupId> element before the <modelVersion> element. See the following as an example.

      <groupId>org.wso2.identity</groupId>
      <modelVersion>4.0.0</modelVersion>
      <artifactId>playground2</artifactId>
      <packaging>war</packaging>
      <name>OAuth 2.0 Playground App with WSO2 Identity Server 5.0.0</name>
      <version>5.0.0</version>
      <url>http://maven.apache.org</url>
  3. To generate the .war file you must run the following Apache Maven command in the sample's location using the command line.

    mvn clean install
  4. Copy the playground2.0.war file to the <TOMCAT_HOME>/webapps directory to deploy the webapp in Apache Tomcat. 

Registering the Playground Application:

  1. Sign in. Enter your username and password to log on to the Management Console
  2. Navigate to the Main menu to access the Identity menu. Click Add under Service Providers.
  3. Fill in the Service Provider Name and provide a brief Description of the service provider.
  4. Register the playground application as an OAuth 2.0 application with the following configurations. See here for details on how to do this.

    Callback URL - http://localhost:8080/playground2/oauth2client
    Allowed Grant Types = Code, Implicit  
  5. After successful registration the application is given a Client Id and a Client Secret.

Completing the user profile:

  1. Create a user.
  2. Log in as the user you created and go to the dashboard.
  3. Update your profile.

    You can also do this at Configure > Users and Roles > Users, then select the user and update the profile.

  4. Click Update to save your changes.

Running the application:

  1. Visit the URL http://localhost:8080/playground2/oauth2.jsp to start the application.
  2. Enter the following details and click Authorize.

    Authorization Grant Type: Authorization Code
    Client ID: (the client id received at the application registration)
    Scope: openid
    Callback URL: http://localhost:8080/playground2/oauth2client
    Authorize Endpoint: https://localhost:9443/oauth2/authorize

  3. Click on Continue.
  4. Log in with the created user.
     
  5. Click Approve Always to consent to this action.
     
  6. Provide the following and click on Get Access Token.

    Callback URL: http://localhost:8080/playground2/oauth2client
    Access Token Endpoint: https://localhost:9443/oauth2/token
    Client Secret: (client secret received at the application registration)

  7. At this point the application receives the ID Token along with the Access Token. The ID Token is used to login the user to the application. Now you can see the logged in user. 
  8. Enter the UserInfo Endpoint URL https://localhost:9443/oauth2/userinfo?schema=openid and click on Get UserInfo.
  9. Now you should be able to see the user information.
     
  10. You can try different consent values {none, login and consent}.

  • No labels