是否有示例应用程序将WIF与ASP.NET MVC应用程序一起使用?有人能帮我开始尝试整合这两种技术吗?Windows Identity Foundation示例MVC应用程序
回答
我发现到目前为止最好的例子是Dominick Baiers StarterSTS。
即使您不使用它作为STS,网站上的教程也是一个很好的起点。没有专门的ASP.NET MVC教程,但我的工作方式与ASP.NET WebForms相同。
总之所以......
- 下载WIF和WIF SDK - http://msdn.microsoft.com/en-us/evalcenter/dd440951.aspx
- 下载StarterSTS - http://startersts.codeplex.com/
- 按照STS介绍视频 - https://identity.thinktecture.com/download/startersts/v1/StarterSTS_InitialSetup.wmv
- 按照ASP.NET教程 http://identity.thinktecture.com/download/starterSTS/v1/StarterSTS_FederatingWebApps.wmv
- 在VS 2010中创建一个新的MVC项目
- 在项目上单击鼠标右键,选择“添加STS参考”,然后按照与WebForms应用程序相同的向导步骤进行操作。 (到WIF信息添加到您的web.config文件。)
现在,当您尝试登录到你的MVC应用程序,你会使用StarterSTS身份提供者,它会记录你..
如果你在你的任何控制器方法调试你现在会看到你有一个WIF“ClaimsPrincipal”(实现IPrincipal的,所以是向后兼容)
有一点要注意的是,只有教程真的覆盖认证。
为了能够从MVC应用程序注销...
增加提及Microsoft.IdentityModel
(“已知”的错误是,它并没有在VS2010添加露面参考对话框,所以你必须直接在C:\ Program Files \ Reference Assemblies \ Microsoft \ Windows Identity Foundation \ v3.5 \ Microsoft.IdentityModel.dll)中引用dll。
在模板化的MVC AccountControllers LogOff方法中,您现在可以致电...
WSFederationAuthenticationModule.FederatedSignOut(null, new Uri("https://RP/"));
其中RP是您自己的基于MVC的依赖方的URI。
完成所有设置后,使用另一个STS(如ADFS(Active Directory联合身份验证服务))很容易。 (因为除了重新配置应用程序以使用它以外,您无需执行任何操作)。
作为一个附注,更多的屏幕演职人员可以是found here。
希望这会有所帮助。这都是一个雷区:-)
有一个简短的高层次的文章,应该包括基本知识here。
对于真正的示例代码,微软Identity Developer Training Kit包括ASP.NET的例子(以及Silverlight和更多)。
此外,微软发表长篇PDF called "A Quick Guide to Claims-Based Identity and Access Control"这应该是一个有益的参考(第3章)。
一旦你了解WIF如何与ASP.NET的WebForms,看看后here以创建ASP.NET MVC
MVC + WIF的一个简单的例子一个自定义的授权属性可以在找到“联盟与多个合作伙伴”指南的章节refered以上。直接链接在这里:http://msdn.microsoft.com/en-us/library/ff359105(v=PandP.10).aspx
它是如何工作的记录在这里的基本知识:http://blogs.msdn.com/b/eugeniop/archive/2010/04/03/wif-and-mvc-how-it-works.aspx
- 1. Windows Identity Foundation
- 2. Windows Presentation Foundation(WPF)+ Windows Identity Foundation(WIF)
- 3. Windows Identity Foundation - FedAuth cookie过期
- 4. EPiServer和Windows Identity Foundation(WIF)
- 5. Windows Identity Foundation 4.5配置
- 6. 为什么WIF(Windows Identity Foundation)?
- 7. Windows Presentation Foundation自适应应用程序
- 8. 在Windows Identity Foundation中禁用加密
- 9. 在Docker中启用Windows Identity Foundation
- 10. asp.net mvc示例应用程序
- 11. ASP.NET MVC示例企业应用程序?
- 12. ASP.NET MVC示例MS应用程序?
- 13. MEF for Windows App示例应用程序?
- 14. Sphero Windows示例应用程序?
- 15. 如何使用Windows Identity Foundation在服务器上存储用户数据而不是Cookie使用Windows Identity Foundation
- 16. 有关在Visual Studio Express中使用Windows Identity Foundation的提示?
- 17. 在PHP上实现Windows Identity Foundation
- 18. Windows Identity Foundation System.Xml.XmlException:文件意外结束
- 19. 安装不带Internet的Windows Identity Foundation 3.5?
- 20. 将Windows Identity Foundation与NServiceBus集成
- 21. 获得Windows Identity Foundation“开发人员培训工具包”示例工作
- 22. Windows Identity Foundation - 运行Identity Developer培训套件的问题
- 23. Window Identity Foundation vs DotnetOpenAuth
- 24. 无法运行Windows Workflow Foundation示例HiringRequest
- 25. 来自单个MVC的SAPUI5 MVC应用程序示例
- 26. UX Web应用程序示例示例
- 27. 无法使用我自己的client_id制作“Identity”示例应用程序
- 28. 需要ExtJS的示例应用程序转换为MVC应用程序
- 29. 春示例应用程序
- 30. Azure示例应用程序
这是一个伟大的职位,感谢分享。 – Paul 2010-12-23 15:46:20
+1与VS2010和丰富的职位指出错误!干杯 – Craig 2011-11-30 19:29:40