使用 WCF 身份验证服务进行 Web 应用程序
我正在使用通过 Web 应用程序设置的 WCF 身份验证服务。我已成功设置并测试了 AuthenticationService 和 RolesService。 Web 应用程序可以通过 WCF 服务成功调用 ValidateUser 和 GetRolesForCurrentUser 等方法。
我想将 WCF 身份验证服务与我的 web.config 和 site.map 集成。我是否需要编写自定义提供程序,或者是否可以通过某种方式修改 Web 应用程序的 web.config 以使用 WCF 身份验证服务作为其成员资格提供程序?
这样我就可以根据 WCF 身份验证服务设置哪些角色可以访问哪些目录。
I am using a WCF authentication service I set up with a web application. I have successfully set up and tested the AuthenticationService and RolesService. The web application can successfully call methods like ValidateUser and GetRolesForCurrentUser through the WCF services.
I want to integrate the WCF authentication service with my web.config and site.map. Do I need to write a custom provider, or is there some way I can modify the web.config of the web application to use the WCF authentication service as its membership provider?
This way I can set what roles have access to what directories based off the WCF authentication service.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
应用程序服务并非旨在替代提供程序堆栈。
它们旨在增强并支持从 .aspx 以外的上下文中使用。
在大多数情况下,您可以简单地使用默认的提供程序堆栈(成员/角色/配置文件)。
您只需在服务调用的上下文中传递通过应用程序服务调用“登录”时获得的 cookie。
有关向 WCF 调用添加 Cookie 的更多信息,请参阅此处。
如果您使用 AJAX 来调用服务,则无需执行任何操作,只需通过 ajax 进行身份验证,然后通过 ajax 进行调用即可。
Application Services are not intended as a replacement for the provider stack.
They are meant to augment and enable usage from context other than .aspx.
In most cases you may simply use the default provider stack (Membership/Roles/Profiles).
You simply need to pass the cookies that you get when you call 'Login' via app services around in the context of the service call.
See here for some more information about adding cookies to a WCF call.
If you are using AJAX to call the services, you don't have to do anything, simply authenticate via ajax and then call via ajax.
天空的回答似乎没有回答问题?
在我看来,确实需要从 ASP.NET 应用程序调用 WCF AuthenticationService?
考虑一个三层应用程序,其中所有数据库访问都强制由应用程序层执行。有一个包含业务数据和会员数据的数据库(数据层)。
我编写了一个三层实现,其中表示层上的自定义 MembershipProvider 调用应用程序层上的 AuthenticationService,后者又运行我的自定义身份验证例程。
我可以很容易地创建一个自定义 WCF 服务(例如不是 AutheticationService)来执行此身份验证,但我尝试尽可能使用 .NET 对象。
如果我可以告诉 ASP.NET 使用 AutheticationService 而无需自定义成员资格提供程序,那就太好了,但我认为这是不可能的?
Skys answer doesn't seem to answer the question?
It seems to me that there is a genuine need to call the WCF AuthenticationService from an ASP.NET application?
Consider a three tier application where all database access is mandated to be performed by the application tier. There is a single database (data tier) containing business data as well as membership data.
I have written a three tier implementation whereby a custom MembershipProvider on the presentation tier invokes the AuthenticationService on the application tier which in turn runs my custom authentication routine.
I could quite easily create a custom WCF service (eg not AutheticationService) which does this authentication but I try to use .NET objects where possible.
it would be nice if I could tell ASP.NET to use the AutheticationService without needing a custom membership provider but I dont think this is possible?