我们有一个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.......
。
从哪里可以更好地了解我应该如何管理我的各种环境下的文件?我有承载这些服务,我们将部署到这种或那种方式以下环境:
- 个人开发者的工作站(3倍于现在,更晚)
- 共享开发环境,为人们编写这些应用程式服务,但并不一定修改服务
- QA
- 分段
- 生产(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>
是的,我知道这与WSDL无关。但是,这与环境有很大关系。原始呈现的FederationMetadata.xml在其中多次包含“http:// localhost /”,这显然是错误的,需要针对每个不同的部署位置进行更改。我不知道如何改变其中的一些内容,例如EntityDescriptor ID或SignatureValue。这是我需要帮助理解的。 – Jaxidian
您似乎想要使用WIF和AD FS来保护WCF Web服务。我的观点很简单,就是你不需要'FederationMetadata.xml':该文件不用于任何Web服务通信。你也可以从你的应用程序中删除这个文件,并且一切仍然有效。 –
这样做意味着我必须使用ADFS 2.0手动配置所有内容,而不是使用XML进行配置,对吗?作为RP它仍然可以正常工作吗?如果是这样的话,那么其实在其他地方只能提出同样的问题。所以现在我想,我需要知道如何在ADFS管理工具中手动配置RP。 – Jaxidian