Architechture of service application in WCF

半城伤御伤魂 提交于 2019-12-01 06:06:54

问题


I need some help with the architechture of a WCF application. The will be a number of services that should be available to serve a number of different clients, e.g.

  • ASP.Net application (JavaScript and/or Silverlight)
  • iPhone
  • Windows Mobile
  • Android

Some of the services need authentication and some will be available w/o authentication.

I need some advice on the services that need authentication, I want to use username/password credentials over SSL.

How (if possible/recommended for all the client types) should I design this in WCF?


回答1:


You can (and should) decouple Authentication from service implementation so that you can vary these independently. This is possible by implementing (or reusing) a ServiceAuthorizationManager.

The nice thing about these is that they can be defined in .config and you can code your entire service without knowing anything about how the user authenticated.

If you need to know more about the user, you can use Thread.CurrentPrincipal.


To implement username/password validation, implement a UserNamePasswordValidator.



来源:https://stackoverflow.com/questions/2064191/architechture-of-service-application-in-wcf

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