0

I would like to add oauth/openID connect configuration under service provider in wso2. How i will add these configuration using soap request. pls help me on that.

Community
  • 1
  • 1

1 Answers1

0
  1. Register OAuth app data(https://localhost:9443/services/OAuthAdminService?wsdl)
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://org.apache.axis2/xsd" xmlns:xsd1="http://dto.oauth.identity.carbon.wso2.org/xsd">
   <soapenv:Header/>
   <soapenv:Body>
      <xsd:registerOAuthApplicationData>
         <!--Optional:-->
          <xsd:application>
            <!--Optional:-->
            <xsd1:OAuthVersion>OAuth-2.0</xsd1:OAuthVersion>
            <!--Optional:-->
            <xsd1:applicationAccessTokenExpiryTime>3600</xsd1:applicationAccessTokenExpiryTime>
            <!--Optional:-->
            <xsd1:applicationName>webapp</xsd1:applicationName>
            <!--Optional:-->
            <xsd1:callbackUrl>http://localhost:8080/webapp/oauth2client</xsd1:callbackUrl>
            <!--Optional:-->
            <xsd1:grantTypes>refresh_token urn:ietf:params:oauth:grant-type:saml2-bearer implicit password client_credentials iwa:ntlm authorization_code</xsd1:grantTypes>
            <!--Optional:-->
            <xsd1:pkceMandatory>false</xsd1:pkceMandatory>
            <!--Optional:-->
            <xsd1:pkceSupportPlain>true</xsd1:pkceSupportPlain>
            <!--Optional:-->
            <xsd1:refreshTokenExpiryTime>84000</xsd1:refreshTokenExpiryTime>
            <!--Optional:-->
            <xsd1:userAccessTokenExpiryTime>3600</xsd1:userAccessTokenExpiryTime>
         </xsd:application>
      </xsd:registerOAuthApplicationData>
   </soapenv:Body>
</soapenv:Envelope>
  1. Get OAuth Application data by name (https://localhost:9443/services/OAuthAdminService?wsdl)
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://org.apache.axis2/xsd">
   <soapenv:Header/>
   <soapenv:Body>
      <xsd:getOAuthApplicationDataByAppName>
         <!--Optional:-->
         <xsd:appName>webapp</xsd:appName>
      </xsd:getOAuthApplicationDataByAppName>
   </soapenv:Body>
</soapenv:Envelope>

Note : oauthConsumerKey and oauthConsumerSecret from the response

<ax2402:oauthConsumerKey>kCVqngLf6fs0lQeXZwxL16ArRrAa</ax2402:oauthConsumerKey>
        <ax2402:oauthConsumerSecret>jauiJEAICB7Klk5us6FMSWjeEJoa</ax2402:oauthConsumerSecret>
  1. Create an application (service provider) ( https://localhost:9443/services/IdentityApplicationManagementService?wsdl)
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://org.apache.axis2/xsd" xmlns:xsd1="http://model.common.application.identity.carbon.wso2.org/xsd" xmlns:xsd2="http://script.model.common.application.identity.carbon.wso2.org/xsd">
   <soap:Header/>
   <soap:Body>
      <xsd:createApplication>
         <xsd:serviceProvider>
            <xsd1:applicationName>sample</xsd1:applicationName>
         </xsd:serviceProvider>
      </xsd:createApplication>
   </soap:Body>
</soap:Envelope>
  1. Get the Application and note the applicationID (https://localhost:9443/services/IdentityApplicationManagementService?wsdl)
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://org.apache.axis2/xsd">
   <soap:Header/>
   <soap:Body>
      <xsd:getApplication>
         <!--Optional:-->
         <xsd:applicationName>sample</xsd:applicationName>
      </xsd:getApplication>
   </soap:Body>
</soap:Envelope>

Note : <ax2171:applicationID>15</ax2171:applicationID>

  1. Update inboundAuthenticationConfig of the application created in step 3 (https://localhost:9443/services/IdentityApplicationManagementService?wsdl) Use:
  • applicationID found in step 4
  • oauthConsumerKey found in step 2 as the inboundAuthKey
  • oauthConsumerSecret found in step 2 as oauthConsumerSecret property value
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://org.apache.axis2/xsd" xmlns:xsd1="http://model.common.application.identity.carbon.wso2.org/xsd" xmlns:xsd2="http://script.model.common.application.identity.carbon.wso2.org/xsd">
   <soap:Header/>
   <soap:Body>
      <xsd:updateApplication>
         <xsd:serviceProvider>
            <xsd1:applicationID>15</xsd1:applicationID>
            <xsd1:applicationName>sample</xsd1:applicationName>
             <xsd1:inboundAuthenticationConfig>
               <xsd1:inboundAuthenticationRequestConfigs>
                  <xsd1:inboundAuthKey>kCVqngLf6fs0lQeXZwxL16ArRrAa</xsd1:inboundAuthKey>
                  <xsd1:inboundAuthType>oauth2</xsd1:inboundAuthType>
                  <xsd1:properties>
                     <xsd1:name>oauthConsumerSecret</xsd1:name>
                     <xsd1:value>jauiJEAICB7Klk5us6FMSWjeEJoa</xsd1:value>
                  </xsd1:properties>
               </xsd1:inboundAuthenticationRequestConfigs>
            </xsd1:inboundAuthenticationConfig>
         </xsd:serviceProvider>
      </xsd:updateApplication>
   </soap:Body>
</soap:Envelope>

Refer: https://docs.wso2.com/display/IS570/Service+Provider+Configurations+used+with+APIs#ServiceProviderConfigurationsusedwithAPIs-ConfiguringOAuth/OpenIDConnect

Anuradha Karunarathna
  • 2,717
  • 2
  • 9
  • 17
  • i used the above soap req to create oauth config its created successfully but unable to see on wso2is v5.7 console means on ui under service provider – Vijay Yadav Jun 21 '21 at 16:11
  • Did you follow all 5 steps? The first step is to create oauth config only. Just creating that doesn't list under service providers in the management console. Whatever service provider you create in step 3 will be listed under service provider. Step 5 is to attach oauth configs to the created service provider – Anuradha Karunarathna Jun 21 '21 at 16:20
  • What i m doing - first create service provider - then create oauth configuration with service provider then and go to wso2 console to see the oauth configuration data but there is not data displaying over there – Vijay Yadav Jun 21 '21 at 17:16
  • is there any short cut way to do this without using above 5 steps – Vijay Yadav Jun 21 '21 at 17:18