请求向 NerdDinner ASP.NET MVC 应用程序添加 Openid 支持的教程
我正在寻找使用 ASP.NET MVC NerdDinner 教程来了解 ASP.NET MVC 和 OpenId。
我想将 NerdDinner 中的身份验证系统替换为仅 OpenId。 我已经下载了最新的 DotNetOpenAuth 库,但我不确定如何将它们组合在一起。 任何人都可以帮助提供快速的分步教程吗?
这就像放入库一样简单吗?还是应用程序还需要进行重大更改?
I'm looking learn about ASP.NET MVC and OpenId using the ASP.NET MVC NerdDinner tutorial.
I would like to replace the Authentication system in NerdDinner to be OpenId only. I've downloaded the latest DotNetOpenAuth libraries but I'm not sure how to put it all together. Can anyone help with a quick step-by-step tutorial?
Is this as simple as dropping in the library or are there significant changes needed to the application as well?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
下载 dotnetopenid 后,请查看示例\RelyingPartyMvc 目录。 有一个示例,他们用 OpenID 替换了默认的 MVC 身份验证系统。 相关代码位于Controllers/UserController.cs中。 这是身份验证操作:
Once you download dotnetopenid, look in the samples\RelyingPartyMvc directory. There is a sample where they replace the default MVC authentication system with OpenID. The relevant code is in Controllers/UserController.cs. Here is the Authenticate action:
不是 NerdDinner 特定的,但对于想要在 ASP.NET MVC 应用程序中实现 OpenId 支持的人来说可能很有用:
ASP.NET MVC 站点
ASP.NET MVC OpenID 登录
经验
Not NerdDinner specifiс but could be useful for ones who want to implement OpenId support in their ASP.NET MVC application:
ASP.NET MVC site
ASP.NET MVC OpenID login
experience
好的,所以我得到了这样的工作!
答案是以下答案的组合加上一些控制器和视图的修改。
首先下载 DotNetOpenAuth,然后导航到示例目录,您可以在其中找到 OpenIdRelayingPartyMvc 代码。
在我的 NerdDinner 解决方案中,
现在,它的工作方式有限。 我可以使用 OpenID 登录 NerdDinner 应用程序并与之交互。 所以这很酷。 然而,某些功能还无法运行。 保存创建的晚餐不起作用,但它也不会挂起。 我必须研究如何将 AccountController 中的一些成员资格功能迁移到 UserController。 我将更新这篇文章(欢迎建议和指点)。
Ok, So I got this sort of working!
The answer is a combination of the answers below plus some mucking around with the controllers and views.
First download DotNetOpenAuth and then navigate to the samples directory where you can find the OpenIdRelayingPartyMvc code.
In my NerdDinner solution,
Right now this works in a limited way. I can logon and interact with the NerdDinner app with an OpenID. So that's cool. However some functionality doesn't yet work. Saving a created dinner doesn't work but it doesn't hang either. I'll have to investigate how to migrate some of the membership functionality in AccountController to UserController. I'll update this post (suggestions and pointers welcome).
Codeplex 上有一个会员入门工具包,应该就是您正在寻找的。 如果他们遵循微软身份验证约定,那么他们都应该遵循提供者模型(阅读它)。
http://mvcmembership.codeplex.com/
There is a membership starter kit on codeplex that should be what you are looking for. They should both be following the provider model (read up on it) if they follow the microsoft authentication convention.
http://mvcmembership.codeplex.com/
查看 Samples/OpenIdRelyingPartyMvc 目录(使用 OpenId 身份验证的简单 ASP.NET MVC 网站)。 您可以从将 Home/User Controllers/Views 和设置从 web.config 复制到您的项目开始。 我认为这是为您的网站提供 OpenId 身份验证的最快方法。 然后, 正如 Alexander Prokofyev 所说,Andrew Arnott(DotNetOpenAuth/DotNetOpenId 作者)博客上有一篇非常有用的帖子 - 添加 OpenID 登录支持您的 ASP.NET MVC 站点
Look at the Samples/OpenIdRelyingPartyMvc dir (a simple ASP.NET MVC website using OpenId authentication). You can start from copying Home/User Controllers/Views and settings from web.config into your project. I think it is the fastest way to give your site OpenId authentication. Then, as Alexander Prokofyev said, there is very useful post at the Andrew Arnott's (DotNetOpenAuth/DotNetOpenId author) blog - Add OpenID login support to your ASP.NET MVC site