Silverlight WCF Authentication (Help going from WPF to Silverlight)

£可爱£侵袭症+ 提交于 2019-12-08 00:57:35

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/885326/silverlight-wcf-authentication-help-going-from-wpf-to-silverlight

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!