2012-12-18 33 views
1

我有一個WCF服務託管在單個端點上,其中包含<ws2007FederationHttpBinding>。該服務使用WIF令牌進行保護。使用WIF令牌保護的WCF服務需要公共方法

服務有一個方法void IsOnline()來確定服務的可用性。此方法必須可以在沒有令牌的情況下進行調用,並且我不能分割接口,也不能添加另一個不安全的端點。 (=配置服務限制)

那麼,我可以修改我的綁定基本狀態「使用WIF令牌是可選的」?換句話說:服務應該使用來自呼叫者的聲明和身份,或者如果沒有提供令牌,則使用某種匿名令牌。

我目前的綁定:

<microsoft.identityModel> 
    <service saveBootstrapTokens="true"> 
     <audienceUris> 
     <add value="https://.../MyServiceCaller" /> 
     </audienceUris> 
     <federatedAuthentication> 
     <wsFederation passiveRedirectEnabled="true" issuer="https://.../MyFederationProviderHere" realm="https://.../MyServiceCaller" requireHttps="true" /> 
     <cookieHandler requireSsl="true" /> 
     </federatedAuthentication> 
     <applicationService> 
     <claimTypeRequired> 
      <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name" optional="true" /> 
      <claimType type="http://schemas.microsoft.com/ws/2008/06/identity/claims/role" optional="true" /> 
     </claimTypeRequired> 
     </applicationService> 
     <serviceCertificate> 
     <certificateReference x509FindType="FindByThumbprint" findValue="123123" /> 
     </serviceCertificate> 
     <issuerNameRegistry type="Microsoft.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> 
     <trustedIssuers> 
      <add thumbprint="123123" name="My.Auth.FederationProvider" /> 
      <add thumbprint="456456" name="My.Auth.FederationProvider" /> 
     </trustedIssuers> 
     </issuerNameRegistry> 
    </service> 
    </microsoft.identityModel> 
    ... 
    <ws2007FederationHttpBinding> 
    <binding name="Host_Ws2007FederationHttp_WithToken"> 
     <security> 
     <message establishSecurityContext="false" issuedKeyType="BearerKey" 
      issuedTokenType="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1" 
      negotiateServiceCredential="false"> 
      <tokenRequestParameters> 
      <trust:SecondaryParameters xmlns:trust="http://docs.oasis-open.org/ws-sx/ws-trust/200512"> 
       <trust:TokenType xmlns:trust="http://docs.oasis-open.org/ws-sx/ws-trust/200512">http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1</trust:TokenType> 
       <trust:KeyType xmlns:trust="http://docs.oasis-open.org/ws-sx/ws-trust/200512">http://docs.oasis-open.org/ws-sx/ws-trust/200512/Bearer</trust:KeyType> 
      </trust:SecondaryParameters> 
      </tokenRequestParameters> 
     </message> 
     </security> 
    </binding> 
    </ws2007FederationHttpBinding> 
+0

可以請你分享服務配置 –

+0

其實我不能。該服務由配置服務動態創建(在stocktraider示例中發佈)。 – fabsenet

回答

1

否 - 在WCF的認證要求是每個端點。您的IsOnline操作需要單獨的端點。然後,您在此端點上使用允許匿名連接的綁定。

+0

我認爲你是對的。我使用另一個STS爲我的IsOnline方法提供了一個有限的臨時標記來解決它。謝謝。 – fabsenet