2011-10-04 42 views
6

我们有一个ADFS 2.0安装,在我们的各种环境中适用于我们的MVC应用程序。我相信它使用“被动认证”(我仍然习惯于正确的术语) - 如果用户没有登录,并且adfs将用户重定向到我们的MVC应用程序,它肯定是将用户重定向到我们的adfs代理的位置一旦他们登录了。如何为各种部署更改我的WCF的FederationMetadata.xml文件?

我们现在开始公开一些安全的Web服务,并希望利用这个相同的身份验证系统。我的理解是,我想使用ws2007FederationHttpBinding作为我的绑定来做到这一点。我相信我有我的WCF的web.config所有设置为此,但我的奋斗现在集中在FederationMetadata.xml文件。

看着这个文件,我看到一些显然需要改变的东西,比如entityID="http://localhost/UserServices"和证书。然后有些东西我不知道它们是什么以及是否需要更改,例如EntityDescriptor ID="_2b510fe8-98b8......<ds:SignatureValue>CZe5mEu19/bDNoZrY8f6C559CJ.......

从哪里可以更好地了解我应该如何管理我的各种环境下的文件?我有承载这些服务,我们将部署到这种或那种方式以下环境:

  1. 个人开发者的工作站(3倍于现在,更晚)
  2. 共享开发环境,为人们编写这些应用程式服务,但并不一定修改服务
  3. QA
  4. 分段
  5. 生产(3个不同的环境中具有不同的证书/域/等)

因此,我们有一个相当简化的流程来管理我们的web.config文件在不同的环境中使用转换和查找/替换某些令牌,所以我想用这个xml文件做同样的事情。所以最终,我所需要的只是在管理这个FederationMetadata.xml文件以适应我的各种环境时需要进行哪些更改的一些理解。

我现在FederationMetadata.base.xml文件下面,我相信这是对的(我只需要名称/角色),我只需要智能更换各种记号,如~RootServiceUrlTokenToReplace~,在这里:

<?xml version="1.0" encoding="utf-8"?> 
<EntityDescriptor ID="~EntityDescriptorIdTokenToReplace~" entityID="http://~RootServiceUrlTokenToReplace~" xmlns="urn:oasis:names:tc:SAML:2.0:metadata"> 
    <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> 
    <ds:SignedInfo> 
     <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> 
     <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" /> 
     <ds:Reference URI="#~ReferenceURITokenToReplace~"> 
     <ds:Transforms> 
      <ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /> 
      <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /> 
     </ds:Transforms> 
     <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" /> 
     <ds:DigestValue>~DigestValueTokenToReplace~</ds:DigestValue> 
     </ds:Reference> 
    </ds:SignedInfo> 
    <ds:SignatureValue>~SignatureValueTokenToReplace~</ds:SignatureValue> 
    <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#"> 
     <X509Data> 
     <X509Certificate>~CertificateTokenToReplace~</X509Certificate> 
     </X509Data> 
    </KeyInfo> 
    </ds:Signature> 
    <RoleDescriptor xsi:type="fed:ApplicationServiceType" protocolSupportEnumeration="http://schemas.xmlsoap.org/ws/2005/02/trust http://docs.oasis-open.org/ws-sx/ws-trust/200512" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:fed="http://docs.oasis-open.org/wsfed/federation/200706"> 
    <KeyDescriptor use="encryption"> 
     <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#"> 
     <X509Data> 
      <X509Certificate>~CertificateTokenToReplace~</X509Certificate> 
     </X509Data> 
     </KeyInfo> 
    </KeyDescriptor> 
    <fed:ClaimTypesRequested> 
     <auth:ClaimType Uri="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name" Optional="true" xmlns:auth="http://docs.oasis-open.org/wsfed/authorization/200706" /> 
     <auth:ClaimType Uri="http://schemas.microsoft.com/ws/2008/06/identity/claims/role" Optional="true" xmlns:auth="http://docs.oasis-open.org/wsfed/authorization/200706" /> 
    </fed:ClaimTypesRequested> 
    <fed:TargetScopes> 
     <EndpointReference xmlns="http://www.w3.org/2005/08/addressing"> 
     <Address>http://~RootServiceUrlTokenToReplace~</Address> 
     </EndpointReference> 
    </fed:TargetScopes> 
    <fed:ApplicationServiceEndpoint> 
     <EndpointReference xmlns="http://www.w3.org/2005/08/addressing"> 
     <Address>http://~RootServiceUrlTokenToReplace~</Address> 
     </EndpointReference> 
    </fed:ApplicationServiceEndpoint> 
    </RoleDescriptor> 
</EntityDescriptor> 

回答

1

基于WIF的应用程序的FederationMetadata.xml与它提供的基于声明的网络服务无关。

(指向一个URL)FederationMetadata.xml被AD FS用来自动更新要在信赖方信任中使用的信息。 AD FS可以例如定期查询此URL,并相应地更新依赖方信任信息。

有关Web服务(基于声明或其他)的信息(即其元数据)作为WSDL文档发布。在基于WCF的服务中,这是一个经常如下所示的URL:http://myhost.example.com/appName/serviceName.svc?wsdl。 WSDL文档通常不作为物理文件存在,而是由WCF自动生成。

+0

是的,我知道这与WSDL无关。但是,这与环境有很大关系。原始呈现的FederationMetadata.xml在其中多次包含“http:// localhost /”,这显然是错误的,需要针对每个不同的部署位置进行更改。我不知道如何改变其中的一些内容,例如EntityDescriptor ID或SignatureValue。这是我需要帮助理解的。 – Jaxidian

+0

您似乎想要使用WIF和AD FS来保护WCF Web服务。我的观点很简单,就是你不需要'FederationMetadata.xml':该文件不用于任何Web服务通信。你也可以从你的应用程序中删除这个文件,并且一切仍然有效。 –

+0

这样做意味着我必须使用ADFS 2.0手动配置所有内容,而不是使用XML进行配置,对吗?作为RP它仍然可以正常工作吗?如果是这样的话,那么其实在其他地方只能提出同样的问题。所以现在我想,我需要知道如何在ADFS管理工具中手动配置RP。 – Jaxidian

0

我发现我的问题部分回答in this blog post。我正在研究它是否能够解答我的所有问题。我刚刚找到它。显然,我需要更改我的EntityID(包含URL),因为我重新将其部署到不同的环境中,但SignatureValue包含该URL的散列(等等),所以通过修改URL,我无效SignatureValue,它需要被再生。显然这FederationMetadata Generator可以帮助我。

相关问题