Sorry for the big title.
So I've been doing some research for making login systems. I've already made my own, but discovered a more secure way to do it. As far as I know, the four basic components of this login system are:
- FormsAuthentication
- MembershipProvider
- RoleProvider
- Principal
I have this as my basic user model:
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; }
}
This is just for retaining the data from the database.
I still want to use this model with the components listed above.
Does anyone know a good and thorough tutorial that explains how to create a custom login system using the above components in MVC 3 Razor?
Thanks in advance.
You can build a custom 'login system' by implementing a custom version of
MembershipProviderandRoleProviderthat 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
MembershipProviderhere and details on a customRoleProviderhere. Samples implementations are included.