Can I create a service with WCF that generate SupportingTokens policy?

若如初见. 提交于 2019-12-11 06:17:13

问题


I am setting an existing WCF service to meet some client requirements. One of the demands is to use a UserNameToken authentication on a service with WS-Addressing disabled and the policy generated on the WSDL in 'SupportingTokens' format, as below.

 <wsp:Policy wsu:Id="wss_username_token_service_policy"
    xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
    xmlns="http://schemas.xmlsoap.org/ws/2004/09/policy"
    xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <sp:SupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
            <wsp:Policy>
                <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
                    <wsp:Policy>
                        <sp:WssUsernameToken10 />
                    </wsp:Policy>
                </sp:UsernameToken>
            </wsp:Policy>
        </sp:SupportingTokens>
    </wsp:Policy>

I tried many configurations but always get a tag "sp:SignedSupportingTokens" or other than "sp:SupportingTokens".


At the documentation seems to be nothing specific to this.

According to Ladislav Mrnka in this post, seems to be no support for this assertion type.

If this is correct, it is not possible to generate that wsdl using WCF?

Follows the binding and behavior configurations.

binding:

<customBinding>        
        <binding name="httpsBinding" openTimeout="00:10:00" closeTimeout="00:10:00" sendTimeout="00:10:00" receiveTimeout="00:10:00">
          <security authenticationMode="UserNameOverTransport" allowInsecureTransport="true"  />
             <mtomMessageEncoding messageVersion="Soap12" >
                 <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" 
                            maxBytesPerRead="2147483647" 
                            maxNameTableCharCount="2147483647" />              
             </mtomMessageEncoding>
          <httpsTransport maxReceivedMessageSize="2147483647" />          
        </binding>        
      </customBinding>

behavior:

<behavior name="svcSslAndUserNamePasswordBehavior">
          <serviceMetadata httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
          <serviceSecurityAudit auditLogLocation="Application" suppressAuditFailure="true" serviceAuthorizationAuditLevel="Failure" 
                                messageAuthenticationAuditLevel="Failure" />
          <serviceCredentials>

            <serviceCertificate findValue="certificateInfo" storeLocation="LocalMachine" storeName="My" x509FindType="FindBySubjectName" />
            <userNameAuthentication userNamePasswordValidationMode="Custom" 
                                    customUserNamePasswordValidatorType="UserManagement.UserNameValidator" />            
          </serviceCredentials>
        </behavior>

回答1:


It depends on other required policies. WCF does not support plain SupportingToken but if you use HTTPS and UserNameToken with no other special requirements your binding should work. It produces policy with SignedSupportingToken in WSDL instead but because there is no other message security and because HTTPS is used, you will have no signature in the message but "signed" requirement will be fulfilled by transport (HTTPS).



来源:https://stackoverflow.com/questions/21532039/can-i-create-a-service-with-wcf-that-generate-supportingtokens-policy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!