【问题标题】:Call a WCF service protected by ACS, which uses ADFS as IDP调用受 ACS 保护的 WCF 服务,该服务使用 ADFS 作为 IDP
【发布时间】:2012-09-30 13:12:03
【问题描述】:

Following this post 我创建了一个 WCF 客户端:

  1. 使用 ADFS 针对 AD 对用户进行身份验证。
  2. 向调用者提供 SAML2 票证。
  3. 使用提供的 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 标头时出错。

  1. 我需要在 ACS 中进行哪些配置才能使用 ADFS 提供的令牌?
  2. 我需要使用 ACS 提供的令牌,还是可以在服务中使用 ADFS 提供的令牌? (它似乎正在工作..)

【问题讨论】:

    标签: wcf saml claims-based-identity acs adfs2.0


    【解决方案1】:

    查看linked ACS 示例,它似乎完全符合您的要求。

    【讨论】:

    • 谢谢 Oren - 我会看看那个例子。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-22
    • 1970-01-01
    相关资源
    最近更新 更多