Silverlight WCF 身份验证(从 WPF 到 Silverlight 的帮助)
我有一个现有的工作 WPF 应用程序,在其中我对后端 WCF 服务实现了自己的自定义身份验证。 当我从 WPF 访问此服务时,请按如下方式设置 ServiceProxy:
proxy.ClientCredentials.UserName.UserName = "test";
proxy.ClientCredentials.UserName.Password = "pass";
并且因为我使用 HTTPS,所以 uid/pwd 是安全的。
在 Silverlight 2 中,代理上没有 .ClientCredentials 对象。 我发现的唯一选择是向 Uid/Pwd 的每个 WCF 公开方法添加两个字符串参数。 这对我来说听起来很疯狂,一定有更好的方法,不是吗?
I have an existing working WPF Application in which I have implemented my own custom authentication to a backend WCF service. When I access this service from WPF, setup the ServiceProxy as follows:
proxy.ClientCredentials.UserName.UserName = "test";
proxy.ClientCredentials.UserName.Password = "pass";
and because I'm using HTTPS the uid/pwd is secure.
In Silverlight 2 there is no .ClientCredentials object on the proxy. The only option I've found is to add two string parameters to EVERY WCF Exposed method for Uid/Pwd. That sounds like insanity to me, there MUST be a better way, no?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是,Silverlight 2 仅支持 basicHttpBinding,这意味着它不支持 ClientCredentials。
您有 2 个选择:
1.正如您提到的,传递用户名并传递每个请求。
2. 使用asp.net身份验证并在您的服务中启用asp.net兼容模式。
-- 注意,我下面提到的 TransportSecurityWithMessageCredentials 似乎没有适用于 SL3,因此 SL2 和 SL3 的选项只有上面的 2 个
Silverlight 3 在此基础上进行了改进TransportSecurityWithMessageCredentials,您可以在 Silverlight Web 服务团队博客上找到有关此内容的更多信息(将链接到它,但显然因为我是新用户,所以我不被允许
0 HTH
Unfortunately Silverlight 2 only supports basicHttpBinding which means it doesn't support ClientCredentials.
The 2 options you have are:
1. As you mentioned passing the username and pass with each request.
2. using asp.net authentication and enable asp.net compatability mode in your services.
-- N.B TransportSecurityWithMessageCredentials I mention below didn't seem to make the cut for SL3 so only options are the 2 above for both SL2 and SL3
Silverlight 3 improves on this story with TransportSecurityWithMessageCredentials and you can find out more about this on the Silverlight Web Services Team blog (Would link to it but apparently as I'm a new user I'm not allowed0
HTH