我正在尝试在WCF中为以下场景找到一个标准解决方案:
我有两个服务。Service1想要向service2发送请求。我希望在service2响应他的请求之前,service1将发送凭据以便进行身份验证。
我不想使用ssl或在所有网络服务之间复制证书。
这是我的解决方案:
我将创建一个“安全服务”。
Service1将根据安全服务进行身份验证。
在成功进行身份验证时,此安全服务将向service1提供一个由安全服务签名的自定义令牌。
Service1会将这个令牌附加到它的每个请求上。
Service2将验证此令牌,如果成功,将处理该请求。
答案是,在C# (WCF)中是否有实现这种机制的方法。
谢谢
发布于 2012-04-19 17:37:16
Microsoft为这种类型的声明基础授权提供了WIF(Windows Identity Foundation)。看看这篇文章:
http://msdn.microsoft.com/en-us/magazine/ee335707.aspx
致以问候。
发布于 2012-04-19 18:07:19
如果你在谈论WCF服务,看看哪种类型的安全WCF supports。它是无、传输、消息、TransportWithMessageCredential、TransportCredentialOnly,两者都是。你说过你对运输安全不感兴趣。因此,列表中仍然存在消息安全性。
WCF supports the following credential types when you are using message level security:
Windows. The client uses a Windows token representing the logged in user’s Windows identity. The service uses the credentials of the process identity or an SSL certificate. You will use this in the sample application that demonstrates the first scenario (internal self-hosted service).
UserName. The client passes a user name and password to the service. Typically, the user will enter the user name and password in a login dialog box. The service can validate the user name and password using a Windows account or the ASP.NET membership provider. You will use this in the sample application that demonstrates the third scenario (public Web-hosted service).
Certificate. The client uses an X.509 certificate and the service uses either that certificate or an SSL certificate.
IssueToken. The client and service use the Secure Token Service, which issues tokens the client and service trust. Windows CardSpace uses the Secure Token Service.
None. The service does not validate the client.接下来是你没有说的,但重要的是确定身份验证类型,这是如何托管您的服务,特别是服务2。Windows身份验证适用于内部自托管服务,但我不确定这是否属于您的情况。因此,如果您的服务将托管在IIS上,则Username适合您。而digest authentication的支持正是您所需要的。阅读Digest Authentication on a WCF REST Service。如果它不是IIS托管服务,或者您需要替代解决方案,则可以使用Security Token Service。但最新的更好的解决方案是基于声明的身份验证,你可以在其他答案中找到链接。
https://stackoverflow.com/questions/10224011
复制相似问题