【发布时间】:2012-09-30 13:12:03
【问题描述】:
Following this post 我创建了一个 WCF 客户端:
- 使用 ADFS 针对 AD 对用户进行身份验证。
- 向调用者提供 SAML2 票证。
- 使用提供的 SAML2 票证调用 WCF 服务。
这很好用,但是我的下一部分问题是扩展它以使用 Azure ACS。
我将 RP 添加到 ACS,并在 Visual Studio 中使用 Add STS Reference 将 STS 引用更改为指向 ACS。
我扩展了Token.GetToken 方法,将令牌提供给以下方法:
public static SecurityToken GetToken(SecurityToken adfsToken, string appliesTo, string idpEndpointAddress, out RequestSecurityTokenResponse rsts)
{
WS2007HttpBinding binding = new WS2007HttpBinding();
binding.Security.Message.EstablishSecurityContext = false;
binding.Security.Mode = SecurityMode.TransportWithMessageCredential;
WSTrustChannelFactory trustChannelFactory = new WSTrustChannelFactory(binding, new EndpointAddress(idpEndpointAddress));
trustChannelFactory.TrustVersion = TrustVersion.WSTrust13;
trustChannelFactory.ConfigureChannelFactory();
// Create issuance issuance and get security token
RequestSecurityToken requestToken = new RequestSecurityToken(WSTrust13Constants.RequestTypes.Issue);
requestToken.AppliesTo = new EndpointAddress(appliesTo);
WSTrustChannel tokenClient = (WSTrustChannel)trustChannelFactory.CreateChannelWithIssuedToken(adfsToken);
SecurityToken token = tokenClient.Issue(requestToken, out rsts);
return token;
}
到以下端点:
https://test.accesscontrol.windows.net/v2/wstrust/13/issuedtoken-symmetric
但我得到以下异常:
无法打开安全通道,因为与 远程端点失败。这可能是由于缺席或不正确 EndpointAddress 中指定的 EndpointIdentity 用于创建 渠道。请验证指定或暗示的 EndpointIdentity EndpointAddress 正确识别远程端点。
内部例外:
ACS10001:处理 SOAP 标头时出错。
- 我需要在 ACS 中进行哪些配置才能使用 ADFS 提供的令牌?
- 我需要使用 ACS 提供的令牌,还是可以在服务中使用 ADFS 提供的令牌? (它似乎正在工作..)
【问题讨论】:
标签: wcf saml claims-based-identity acs adfs2.0