我们的一个网络应用程序想要连接ADFS 2.0服务器以获取凭据 token 并据此检查用户角色。 ADFS 服务器管理员要求我们向他们提供联合元数据 XML 文件,以便他们创建依赖方信任。我用谷歌搜索,只找到如何使用 URL 下载 ADFS 服务器的联合元数据 XML - https://[adfs 服务器名称]/federationmetadata/2007-06/federationmetadata.xml 但找不到任何指南来创建联合元数据 XML 来创建“依赖方信任”和“声明提供者信任”。是否有用于创建这些元数据文件的工具?请分享一些关于如何创建的想法。
谢谢
卢
回答我自己的问题:
我在 WindowsIdentityFoundation-SDK-4.0 中找到了联合实用程序工具,网址为 http://www.microsoft.com/en-ca/download/details.aspx?id=4451会做的。
最佳答案
实际上网址是
https://server/federationmetadata/2007-06/federationmetadata.xml
据我所知,没有任何工具。
您可以使用Microsoft.IdentityModel.Protocols.WSFederation.Metadata上课或引用Generating Federation Metadata Dynamically .
看看 “Thinktecture.IdentityServer.v2/src/Libraries/Thinktecture.IdentityServer.Protocols/FederationMetadata”位于 Thinktecture.IdentityServer.v2 .
或者,如果您的应用程序使用 WIF,则它位于元数据目录中。
更新:
在 WIF 中,除非您希望对 token 进行加密,否则不需要证书。这对于 ADFS 端来说更重要,因为它必须签署 token 和应用程序。需要公钥来验证。
示例:
<?xml version="1.0" encoding="utf-8"?>
<EntityDescriptor ID="_5b6cd05c-a5e3-470d-a2fc-6c6f66633d1b" entityID="http://localhost/app/" xmlns="urn:oasis:names:tc:SAML:2.0:metadata">
<RoleDescriptor xsi:type="fed:ApplicationServiceType" xmlns:fed="http://docs.oasis-open.org/wsfed/federation/200706" protocolSupportEnumeration="http://docs.oasis-open.org/wsfed/federation/200706" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<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://localhost/app/</Address>
</EndpointReference>
</fed:TargetScopes>
<fed:PassiveRequestorEndpoint>
<EndpointReference xmlns="http://www.w3.org/2005/08/addressing">
<Address>http://localhost/app/</Address>
</EndpointReference>
</fed:PassiveRequestorEndpoint>
</RoleDescriptor>
</EntityDescriptor>
其中 localhost\app\需要是您应用程序的 URL。注意结束斜杠!
关于metadata - 如何为 ADFS 2.0 创建 "Relying Party Trust"和 "Claims Provider Trusts"的联合元数据 XML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27064826/