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

问题描述:

虽然我通过Identity Server管理面板的Web UI创建服务提供商并添加了入站认证配置 - > SAML2 Web SSO配置一切正常,我看到SAMLSSO提供商稍后扩展标签。使用SOAP API将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 UI添加相同的SAML SSO配置,它会给我一个它已经存在的错误。

使用API​​创建SAMLSSO配置时,表SP_INBOUND_AUTH为空。但是,如果我使用Web UI创建SAML配置,则可以在SP_INBOUND_AUTH表中看到该记录。

我错过了什么?

+0

什么是身份的服务器版本,您正在使用? – pulasthi7

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

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

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

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

+0

谢谢。现在它按照假定的方式工作 – nn4n4s