使用 SOAP API 将 SAMLSSO 提供程序配置添加到服务提供程序

Adding SAMLSSO provider config to service provider using SOAP API

当我创建服务提供商并添加 入站身份验证配置 -> SAML2 Web SSO 配置 通过 Web UI Identity Server 管理面板时,一切正常,我看到稍后在展开的选项卡中添加 SAMLSSO 提供程序。

现在我无法创建服务提供程序并通过 API 添加 SAMLSSO 提供程序。

我正在使用以下服务来完成这项工作:

IdentityApplicationManagementService?wsdl - 用于创建服务提供者。

IdentitySAMLSSOConfigService?wsdl - 用于创建 SAMLSSO 提供程序。

我按顺序发送以下请求:

首先创建 SAMLSSO 提供程序:

    POST /services/IdentitySAMLSSOConfigService.IdentitySAMLSSOConfigServiceHttpsSoap11Endpoint/ HTTP/1.1
    Host: test.com
    Connection: Keep-Alive
    User-Agent: PHP-SOAP/5.6.11-1ubuntu3.4
    Content-Type: text/xml; charset=utf-8
    SOAPAction: "urn:addRPServiceProvider"
    Content-Length: 1228
    Authorization: Basic *****

    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope
        xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:ns1="http://dto.saml.sso.identity.carbon.wso2.org/xsd"
        xmlns:ns2="http://org.apache.axis2/xsd">
        <SOAP-ENV:Body>
            <ns2:addRPServiceProvider>
                <ns2:spDto>
                    <ns1:assertionConsumerUrl xsi:nil="true"/>
                    <ns1:assertionConsumerUrls>https://test.shib/Shibboleth.sso/SAML2/POST</ns1:assertionConsumerUrls>
                    <ns1:attributeConsumingServiceIndex xsi:nil="true"/>
                    <ns1:certAlias xsi:nil="true"/>
                    <ns1:defaultAssertionConsumerUrl>https://test.shib/Shibboleth.sso/SAML2/POST</ns1:defaultAssertionConsumerUrl>
                    <ns1:digestAlgorithmURI xsi:nil="true"/>
                    <ns1:idpInitSLOReturnToURLs xsi:nil="true"/>
                    <ns1:issuer>https://tesh.shib/shibboleth</ns1:issuer>
                    <ns1:loginPageURL xsi:nil="true"/>
                    <ns1:nameIDFormat xsi:nil="true"/>
                    <ns1:nameIdClaimUri xsi:nil="true"/>
                    <ns1:requestedAudiences xsi:nil="true"/>
                    <ns1:requestedClaims xsi:nil="true"/>
                    <ns1:requestedRecipients xsi:nil="true"/>
                    <ns1:signingAlgorithmURI xsi:nil="true"/>
                    <ns1:sloRequestURL xsi:nil="true"/>
                    <ns1:sloResponseURL xsi:nil="true"/>
                </ns2:spDto>
            </ns2:addRPServiceProvider>
        </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

然后我创建了服务提供商,并使用 SAMLSSO 提供商设置了入站身份验证配置,如前所述here:

    POST /services/IdentityApplicationManagementService.IdentityApplicationManagementServiceHttpsSoap11Endpoint/ HTTP/1.1
    Host: test.com
    Connection: Keep-Alive
    User-Agent: PHP-SOAP/5.6.11-1ubuntu3.4
    Content-Type: text/xml; charset=utf-8
    SOAPAction: "urn:createApplication"
    Content-Length: 1934
    Authorization: Basic ****


    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope
        xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:ns1="http://model.common.application.identity.carbon.wso2.org/xsd"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:ns2="http://org.apache.axis2/xsd">
        <SOAP-ENV:Body>
            <ns2:createApplication>
                <ns2:serviceProvider>
                    <ns1:applicationName>tect_com</ns1:applicationName>
                    <ns1:claimConfig xsi:nil="true"/>
                    <ns1:description>Test SP</ns1:description>
                    <ns1:inboundAuthenticationConfig>
                        <ns1:inboundAuthenticationRequestConfigs>
                            <ns1:friendlyName xsi:nil="true"/>
                            <ns1:inboundAuthKey>https://test.shib/shibboleth</ns1:inboundAuthKey>
                            <ns1:inboundAuthType>samlsso</ns1:inboundAuthType>
                            <ns1:properties xsi:nil="true"/>
                        </ns1:inboundAuthenticationRequestConfigs>
                        <ns1:inboundAuthenticationRequestConfigs>
                            <ns1:friendlyName xsi:nil="true"/>
                            <ns1:inboundAuthKey></ns1:inboundAuthKey>
                      <ns1:inboundAuthType>openid</ns1:inboundAuthType>
                            <ns1:properties xsi:nil="true"/>
                        </ns1:inboundAuthenticationRequestConfigs>
                        <ns1:inboundAuthenticationRequestConfigs>
                            <ns1:friendlyName xsi:nil="true"/>
                            <ns1:inboundAuthKey></ns1:inboundAuthKey>
                            <ns1:inboundAuthType>passivests</ns1:inboundAuthType>
                            <ns1:properties xsi:nil="true"/>
                        </ns1:inboundAuthenticationRequestConfigs>
                    </ns1:inboundAuthenticationConfig>
                    <ns1:inboundProvisioningConfig xsi:nil="true"/>
                    <ns1:localAndOutBoundAuthenticationConfig xsi:nil="true"/>
                    <ns1:outboundProvisioningConfig xsi:nil="true"/>
                    <ns1:owner>
                        <ns1:tenantDomain>user.com</ns1:tenantDomain>
                        <ns1:userName>user</ns1:userName>
                        <ns1:userStoreDomain xsi:nil="true"/>
                    </ns1:owner>
                    <ns1:permissionAndRoleConfig xsi:nil="true"/>
                    <ns1:requestPathAuthenticatorConfigs xsi:nil="true"/>
                    <ns1:saasApp>true</ns1:saasApp>
                    <ns1:spProperties xsi:nil="true"/>
                </ns2:serviceProvider>
            </ns2:createApplication>
        </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

两个请求都被接受。我可以在 Web UI 中看到服务提供商,但是带有 SAML Web SSO 配置的部分是空的。

如果我尝试使用我的新 SP 进行身份验证,一切正常。

如果我尝试通过 Web 添加相同的 SAML SSO 配置 UI,它会给我一个错误,提示它已经存在。

使用 API 创建 SAMLSSO 配置时 table SP_INBOUND_AUTH 为空。但是如果我使用 Web UI 创建 SAML 配置,我可以在 SP_INBOUND_AUTH table.

中看到记录

我错过了什么?

创建服务提供者时,应该分两步完成。

  1. 为给定的应用程序名称和描述创建服务提供者 (createApplication)。
  2. 用其他配置更新它 (updateApplication)。

所以在你的情况下,createApplication 应该只用应用程序名称和描述来调用。然后你必须调用 updateApplication 操作并配置其入站身份验证等。

[1] https://docs.wso2.com/display/IS510/Using+the+Service+Provider+API#UsingtheServiceProviderAPI-createApplication