This documentation is for WSO2 Identity Server 5.7.0 . View documentation for the latest release.

All docs This doc
Skip to end of metadata
Go to start of metadata
This topic provides instructions on how to configure a .NET application using the WSO2 Identity Server for authentication. It is demonstrated using a sample OpenID Connect application. 

Before you begin

  1. Installs Visual Studio.
  2. Download the sample from the following SVN location
  3. When accessing the .NET application, there will be a REST call to the token endpoint. As this is a server-to-server call, you need to import the WSO2 Identity Server certificate and export it to Visual Studio Management Console to avoid SSL handshake exceptions.

     Click for instructions to import the WSO2 Identity Server certificate to Visual Studio Management Console:
    1. To generate the client certificate, navigate to the <IS_HOME>\jdk\jdk1.8.0_192jre\bin directory in a command prompt and execute the following command.

      keytool.exe -importkeystore -srckeystore "wso2carbon.jks" -destkeystore "wso2carbon.p12" -srcstoretype JKS -deststoretype PKCS12 -deststorepass <<PASSWORD>>

      Note that the wso2.carbon.p12 certificate gets generated.

    2. To start Microsoft Management Console, run mmc.exe.

    3. Under File, navigate to Add/Remove Snap-in and select Certificates.

    4. To add the certificate to the selected snap-ins, select Computer Account > Next > Local Computer > Finish.
    5. Under Trusted Root Certification Authorities, navigate to the certificates directory.
    6. Right-click on Certificates and select All Tasks > Import.
      Note that the certificate import wizard appears.
    7. Click Next and import the wso2carbon.p12 certificate.
  4. Access WSO2 Identity Server Management Console.

  1. On the Main menu of the Management Console, click Identity > Service Providers > Add.
  2. Enter a name for the service provider and click Register.
  3. Under Inbound Authentication Configuration section, click OAuth/OpenID Connect Configuration > Configure.
  4. Enter a callback URL in the in the http://<<SERVER_URL>>/callback.aspx format, e.g., http://localhost:50420/callback.aspx in the Callback Url text box and click Add.

    For more information on OAuth/OpenID Connect configurations, see Configuring OAuth2-OpenID Connect Single-Sign-On.

    Note that a client key and client secret get generated.

  5. Open the oidc.sln file found in the <SAMPLE_HOME> directory using Visual Studio and run the .NET application. 
  6. The following fields will be auto-populated.
    • Client Id: This is the client key of the service provider.
    • Request URI: http://localhost:50420/callback.aspx
    • Response Type: code
    • Scope: openid
  7. Click Submit.
  8. Sign in to the application.

  9. Grant permission to share the given attributes with the service provider.

  10. You will be redirected to the callback page along with the OAuth code. Fill in the following fields and click Submit to retrieve the token details.  
    • Client Id: This is the client key of the service provider.
    • Secret: This is the client secret of the service provider.
    • Grant Type: authorization_code
    • Request URI:  http://localhost:50420/callback.aspx

    This initiates a REST call to the token endpoint and retrieves the token details.

  11. Once the REST call succeeds, you can see the token details with the base64 decoded JWT (ID Token) details.
  • No labels