6

我们有一个 ADFS 2.0 安装,它适用于我们各种环境中的 MVC 应用程序。我相信它使用“被动身份验证”(我仍在习惯正确的术语) - 如果用户未登录,它肯定会将用户重定向到我们的 adfs 代理,并且 adfs 将用户重定向回我们的 MVC 应用程序一旦他们登录。

我们现在开始公开一些安全的 Web 服务,并希望利用相同的身份验证系统。我的理解是我想ws2007FederationHttpBinding用作我的绑定来执行此操作。我相信我已经为此设置了我的 WCF 的 web.config,但我现在的斗争集中在该FederationMetadata.xml文件上。

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

我在哪里可以更好地了解我应该如何为我的各种环境管理这个文件?我有以下环境托管这些服务,我们将以一种或另一种方式部署这些服务:

  1. 个人开发者工作站(现在是 3x,以后会更多)
  2. 一个共享的开发环境,供人们针对这些服务编写应用程序但不一定要修改服务
  3. 质量保证
  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>
4

2 回答 2

1

A WIF-based application's FederationMetadata.xml is not related to the claims-based web services it offers.

(A URL pointing to) FederationMetadata.xml is used by AD FS, to automatically update the information to be used in a Relying Party Trust. AD FS can for example regularly query this URL, and update the Relying Party Trust information accordingly.

The information about a web service (claims-based or otherwise), i.e., its metadata, is published as a WSDL document. In a WCF-based service this is a URL that often looks like this: http://myhost.example.com/appName/serviceName.svc?wsdl. That WSDL document often does not exist as a physical file, but is automatically generated by WCF.

于 2011-10-06T19:40:49.457 回答
0

在这篇博文中找到了我的问题的部分答案。我正在研究它以发现这是否回答了我所有的问题。我刚找到它。显然,当我将其重新部署到不同的环境时,我确实需要更改我的 EntityID(包含 URL),但 SignatureValue 包含该 URL 的哈希(除其他外?)所以通过修改 URL,我使 SignatureValue 无效并且它需要被再生。显然这个FederationMetadata Generator可以帮助我解决这个问题。

于 2011-10-08T16:11:07.817 回答