WCF中的服务应用架构 [英] Architechture of service application in WCF

查看:26
本文介绍了WCF中的服务应用架构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要有关 WCF 应用程序架构的一些帮助.这将是一些应该可用于为许多不同客户端提供服务的服务,例如

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 应用程序(JavaScript 和/或 Silverlight)
  • iPhone
  • Windows 移动版
  • 安卓

有些服务需要身份验证,有些服务无需身份验证即可使用.

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

我需要一些关于需要身份验证的服务的建议,我想通过 SSL 使用用户名/密码凭据.

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

我应该如何(如果可能/推荐用于所有客户端类型)在 WCF 中设计它?

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

推荐答案

您可以(并且应该)将身份验证与服务实现分离,以便您可以独立地改变它们.这可以通过实施(或重用)ServiceAuthorizationManager.

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.

这些的好处在于它们可以在 .config 中定义,您可以在不了解用户身份验证方式的情况下对整个服务进行编码.

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.

如果您需要了解有关用户的更多信息,可以使用 Thread.CurrentPrincipal.

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

要实施用户名/密码验证,请实施 用户名密码验证器.

To implement username/password validation, implement a UserNamePasswordValidator.

这篇关于WCF中的服务应用架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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