ITPub博客

首页 > IT基础架构 > 网络安全 > WCF Security:Silverlight authentication for WCF service based on security token

WCF Security:Silverlight authentication for WCF service based on security token

原创 网络安全 作者:yuzhangqi 时间:2010-05-21 12:06:41 0 删除 编辑

In my previous blogs I show you how to authenticate WCF service client base on username/password. That is very available for ASP.Net client. But with Silverlight client, it is not available. THe Silverlight application is running on the remote machine of end users, it is not acceptable to transfer usename/password in cleartext in the wire. In addition, Silverlight supports BasicHttpBinding only,so security in transport level is not supported.

In order to authenticate Silverlight caller for WCF service, we need to generate a security token from username,password and a timestamp. The security token is a encrypted text, so we can transfer it over the network securely.

Then another question comes out. How can we pass in the security token in Silverlight application, and how can WCF service retrieve and validate it? The key points are System.ServiceModel.Dispatcher.IClientMessageInspector and System.ServiceModel.Dispatcher.IDispatchMessageInspector.

Create implementations for System.ServiceModel.Dispatcher.IClientMessageInspector and System.ServiceModel.Dispatcher.IDispatchMessageInspector. Respectively, these implementations will “inspect” the message before it is sent, and after it is received; It is during these steps that the header can be injected and read.

Thanks to the authors of the following blogs.

http://problog.jamespritz.com/2009/05/17/custom-headers-in-wcf.aspx

http://weblogs.asp.net/paolopia/archive/2007/08/23/writing-a-wcf-message-inspector.aspx

[@more@]

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/13651903/viewspace-1033801/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-06-10

  • 博文量
    102
  • 访问量
    763297