我们有一个 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.......
。
我在哪里可以更好地了解我应该如何为我的各种环境管理这个文件?我有以下环境托管这些服务,我们将以一种或另一种方式部署这些服务:
- 个人开发者工作站(现在是 3x,以后会更多)
- 一个共享的开发环境,供人们针对这些服务编写应用程序但不一定要修改服务
- 质量保证
- 分期
- 生产(具有不同证书/域/等的 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>