1

对不起,大标题。

所以我一直在做一些关于制作登录系统的研究。我已经自己做了,但发现了一种更安全的方法。据我所知,这个登录系统的四个基本组成部分是:

  • 表单身份验证
  • 会员提供者
  • 角色提供者
  • 主要的

我将此作为我的基本用户模型:

public class User
{
    public int ID { get; set; }
    public string Name { get; set; }
    public string Password { get; set; }
    public string PictureUrl { get; set; }
    public string Role { get; set; }
    public string AccessToken { get; set; }
}

这只是为了保留数据库中的数据。

我仍然想将此模型与上面列出的组件一起使用。

有谁知道一个很好的详尽的教程,它解释了如何使用 MVC 3 Razor 中的上述组件创建自定义登录系统?

提前致谢。

4

2 回答 2

2

You can build a custom 'login system' by implementing a custom version of MembershipProvider and RoleProvider that uses your own database. Then you can re-use all the rest of the built in authentication and authorization stuff.

MSDN has some details on how to build a MembershipProvider here and details on a custom RoleProvider here. Samples implementations are included.

于 2012-08-13T04:24:51.657 回答
0

您可以使用这个开源项目:

https://github.com/TroyGoode/MembershipStarterKit

于 2012-08-12T16:59:18.757 回答