Warm tip: This article is reproduced from serverfault.com, please click

wso2-使用Oauth2和SOAP创建服务提供者

(wso2 - Create Service Provider with Oauth2 with SOAP)

发布于 2020-11-30 16:42:19

我正在尝试通过SOAP创建一个SP。创建SP的调用是正确的,之后我尝试通过SOAP像这样配置oauthConsumerKey和oauthConsumerSecret来配置Oauth2

<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>
         <xsd:application>
            <xsd1:OAuthVersion>OAuth-2.0</xsd1:OAuthVersion>
            <xsd1:applicationAccessTokenExpiryTime>3600</xsd1:applicationAccessTokenExpiryTime>
            <xsd1:applicationName>test</xsd1:applicationName>
            <xsd1:callbackUrl>regexp=(.*)/login/oauth2/code/wso2</xsd1:callbackUrl>
            <xsd1:grantTypes>refresh_token urn:ietf:params:oauth:grant-type:saml2-bearer implicit password client_credentials iwa:ntlm authorization_code urn:ietf:params:oauth:grant-type:uma-ticket urn:ietf:params:oauth:grant-type:jwt-bearer</xsd1:grantTypes>
            <xsd1:oauthConsumerKey>gVWBVK0pdX4pg2Yk3fFbBjKe1aUa</xsd1:oauthConsumerKey>
            <xsd1:oauthConsumerSecret>CbfGJXhTYvb3i1BAfu5ijgUSXXYa</xsd1:oauthConsumerSecret>
            <xsd1:pkceMandatory>false</xsd1:pkceMandatory>
            <xsd1:pkceSupportPlain>true</xsd1:pkceSupportPlain>
            <xsd1:refreshTokenExpiryTime>86400</xsd1:refreshTokenExpiryTime>
            <xsd1:userAccessTokenExpiryTime>3600</xsd1:userAccessTokenExpiryTime>
         </xsd:application>
      </xsd:registerOAuthApplicationData>
   </soapenv:Body>
</soapenv:Envelope>

但在db中,我发现与屏幕连接中的屏幕不同的键,oauth版本,callbackUrl和grant_types DB画面 我在做错什么吗?

当我运行SOAP时,响应为

<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns:registerOAuthConsumerResponse xmlns:ns="http://org.apache.axis2/xsd" xmlns:ax2408="http://dto.oauth.identity.carbon.wso2.org/xsd" xmlns:ax2404="http://oauth.identity.carbon.wso2.org/xsd" xmlns:ax2405="http://base.identity.carbon.wso2.org/xsd"><ns:return>BE2JqA9lOZQKSkMvo4diNy2QHb0a</ns:return><ns:return>7xjxUrbWOztADfODEcvEbn8NeuEa</ns:return></ns:registerOAuthConsumerResponse></soapenv:Body></soapenv:Envelope>
Questioner
Jalisse
Viewed
0
Anuradha Karunarathna 2020-12-01 17:43:40

从评论中得到答案:

  1. 提到的SOAP请求是https:// localhost:9443 / services / OAuthAdminService中的“ registerOAuthApplicationData”请求。预期响应应类似于https://is.docs.wso2.com/en/latest/develop/service-provider-configurations-used-with-apis/#sample-request-and-response_1中给出的示例响应(registerOAuthApplicationDataResponse)如果发出“ registerOAuthApplicationData” SOAP请求,则“ idn_oauth_consumer_apps”表条目应使用给定的详细信息填充(即:提供的客户端密钥,机密,回调等)

  2. 该问题中提到的SOAP响应应用于https:// localhost:9443 / services / OAuthAdminService中的“ registerOAuthConsumer”请求。它使用随机生成的客户端密钥和密钥以及其他默认值来生成OAuth使用者。这样的条目将反映在你的附件图像中。

这意味着你执行了不正确的SOAP请求。