WCF RESTful 服务的基于声明的身份验证
我一直在研究各种示例,尝试拼凑出一个针对 ASP.Net Web 服务和 WCF RESTful Web 服务的基于 SAML 令牌的身份验证的解决方案...我引用的一些示例:
- http://custombasicauth.codeplex.com/Wikipage
- http://leastprivilege.com/2010/02/15/securing-wcf-data-services-using-wif/< /a>
- http://weblogs.asp.net/cibrax/archive/2010/02/17/a-good-way-to-handle-claim-based-security-in-restful-services .aspx
- 等...
我一直在努力克服每个障碍,而且我已经很接近了,我可以尝到它的味道。让我困惑的最新块是这样的:
如果我使用常规的 WebServiceHostFactory,则会应用自定义授权策略,并且 Thread.CurrentPrincipal 最终会采用我的 HttpModule 为 HttpContext.Current.User 设置的值...但是...如果我使用 WebServiceHost2Factory(即来自 REST Starter Kit)来获取自动帮助端点等...,然后不应用身份验证策略,并且 Thread.CurrentPrincipal 最终成为 RoleProviderPrincipal 的实例,与ClaimsPrincipal 我在 HttpModule 中设置..:-(
有什么想法、想法如何让 WebServiceHost2Factory 与自定义/覆盖的主体很好地配合吗?
谢谢,
Tyler
I've been working through various samples to try and piece together a solution for SAML token-based authentication for ASP.Net web services and WCF RESTful web services... some of the samples I've been referencing:
- http://custombasicauth.codeplex.com/Wikipage
- http://leastprivilege.com/2010/02/15/securing-wcf-data-services-using-wif/
- http://weblogs.asp.net/cibrax/archive/2010/02/17/a-good-way-to-handle-claim-based-security-in-restful-services.aspx
- etc...
I've been battling my way through each roadblock, and I'm so close I can taste it. The latest block that's got me is this:
If I use the regular WebServiceHostFactory, the custom authorization policies are applied and Thread.CurrentPrincipal ends up taking the value that my HttpModule set for HttpContext.Current.User... but... if I use the WebServiceHost2Factory (i.e. from the REST Starter Kit) to gain the auto help endpoint, etc..., then the auth policies aren't applied, and the Thread.CurrentPrincipal ends up being an instance of RoleProviderPrincipal in no way related to the ClaimsPrincipal I set in the HttpModule.. :-(
Any thoughts, ideas how to get the WebServiceHost2Factory to play nice with the custom / overridden principal?
Thanks,
Tyler
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
似乎这个问题在 MSDN/WCF 论坛的交叉帖子中得到了回答:
http://social.msdn.microsoft .com/Forums/en/wcf/thread/28fdaa9f-b75a-4ad6-a5f7-7e5af5dc909b
--larsw
Seems like the question was answered in the cross post in the MSDN/WCF forum:
http://social.msdn.microsoft.com/Forums/en/wcf/thread/28fdaa9f-b75a-4ad6-a5f7-7e5af5dc909b
--larsw