问题描述
我有一个在WIF下运行并希望对其中包含的
a WCF服务进行简单的用户名/密码身份验证的Web应用程序。这是可能的,如果是这样的话?
推荐答案
澄清问题:  ; WCF服务是否只需要允许访问经过身份验证的用户,或者您是否希望WCF服务实际执行身份验证? 如果前者(我认为您可能意味着),那么您可以使用IPrincipal / IIdentity中包含的
值作出明智的决定以允许访问。 如果是后者,那么您似乎希望WCF服务承担身份提供者的角色。 如果WCF服务是外部(在Web应用程序之外)
实体,我建议遵循编写身份提供程序的正常准则,然后将Web应用程序连接到它以进行身份验证,就像其他任何方式一样身份提供商。 但是,由于您说Web应用程序中的WCF服务包含
,我怀疑这是否可以正确完成。
Clarifying question: Does the WCF service needs to only allow access to authenticated users, or did you want the WCF service to actually DO the authentication? If the former, which I think you probably mean, then you can use the values contained in IPrincipal / IIdentity to make an informed decision to allow access. If it's the latter, then it seems you want the WCF service to take on the role of an Identity Provider. IF the WCF service were an external (outside the web application) entity, I would suggest following the normal guidelines for the writing an Identity Provider, then just hook up the Web Application to it for Authentication the way you would any other Identity Provider. However, since you say the WCF Service is contained within the web app, I doubt this can be done correctly.
这篇关于使用Windows Identity Foundation在Web App中对WCF服务进行身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!