WCF TCP 传输安全和 WIF

发布于 2024-12-03 06:06:37 字数 1081 浏览 0 评论 0原文

我的公司使用 WIF(Windows Identity Foundation)来保护我们的服务。目前我们仅通过 HTTPS 使用 WIF。然而,我们需要保护 TCP 端点,但我遇到了一些麻烦。

我遇到以下异常:


The '{binding name}'.'http://tempuri.org/' binding for the '{IService}'.
'http://tempuri.org/' contract is configured with an authentication mode that requires 
transport level integrity and confidentiality. However the transport cannot provide 
integrity and confidentiality.

为了将 WIF 纳入图片中,我们必须在服务主机内执行此操作:


var istp = new IssuedSecurityTokenParameters(_TokenType, _IssuerAddress, _IssuerBinding) // issuer address/binding do not matter for this, but must provide something
{
    RequireDerivedKeys = false, 
    KeyType = System.IdentityModel.Tokens.SecurityKeyType.BearerKey
}; 

TransportSecurity = new TransportSecurityBindingElement();
TransportSecurity.EndpointSupportingTokenParameters.Signed.Add(istp);
TransportSecurity.MessageSecurityVersion = MessageSecurityVersion.WSSecurity11WSTrust13WSSecureConversation13WSSecurityPolicy12; 

我无法取出这些代码行,但我不知道我缺少什么配置来实现此目的与 TCP 一起工作。任何帮助都会很棒。

My company uses WIF (Windows Identity Foundation) to secure our sevices. Currently we only use WIF over HTTPS. However, we need to secure a TCP endpoint and I'm running into some trouble.

I'm getting following exception:


The '{binding name}'.'http://tempuri.org/' binding for the '{IService}'.
'http://tempuri.org/' contract is configured with an authentication mode that requires 
transport level integrity and confidentiality. However the transport cannot provide 
integrity and confidentiality.

In order to get WIF into the picture we have to do this inside the service host:


var istp = new IssuedSecurityTokenParameters(_TokenType, _IssuerAddress, _IssuerBinding) // issuer address/binding do not matter for this, but must provide something
{
    RequireDerivedKeys = false, 
    KeyType = System.IdentityModel.Tokens.SecurityKeyType.BearerKey
}; 

TransportSecurity = new TransportSecurityBindingElement();
TransportSecurity.EndpointSupportingTokenParameters.Signed.Add(istp);
TransportSecurity.MessageSecurityVersion = MessageSecurityVersion.WSSecurity11WSTrust13WSSecureConversation13WSSecurityPolicy12; 

I can't take those lines of code out but I don't know what configuration I'm missing to make this work with TCP. Any help at all would be great.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文