Silverlight WCF身份验证(帮助从WPF到Silverlight) [英] Silverlight WCF Authentication (Help going from WPF to Silverlight)

查看:59
本文介绍了Silverlight WCF身份验证(帮助从WPF到Silverlight)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个现有的工作WPF应用程序,其中已经对后端WCF服务实现了自己的自定义身份验证.当我从WPF访问此服务时,请按以下步骤设置ServiceProxy:

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";

并且因为我正在使用HTTPS,所以uid/pwd是安全的.

and because I'm using HTTPS the uid/pwd is secure.

在Silverlight 2中,代理上没有.ClientCredentials对象.我发现的唯一选择是为Uid/Pwd的每个WCF Exposed方法添加两个字符串参数.对我来说这听起来像是精神错乱,一定有更好的方法,不是吗?

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?

推荐答案

不幸的是,Silverlight 2仅支持basicHttpBinding,这意味着它不支持ClientCredentials.

Unfortunately Silverlight 2 only supports basicHttpBinding which means it doesn't support ClientCredentials.

您有2个选项: 1.如前所述,传递用户名并随每个请求传递. 2.使用asp.net身份验证并在您的服务中启用asp.net兼容模式.

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似乎并没有成为SL3的切入点,因此只有SL2和SL3的上述两个选项都可以使用

-- 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通过TransportSecurityWithMessageCredentials改进了这个故事,您可以在Silverlight Web服务团队博客上找到有关此问题的更多信息(可以链接到它,但是显然我是新用户,所以我不被允许0

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

这篇关于Silverlight WCF身份验证(帮助从WPF到Silverlight)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆