开发者

User/PW System for an MVC 3 app

开发者 https://www.devze.com 2023-04-04 00:39 出处:网络
So I\'ve read numerous articles on a password system for a web app, and they all seem very confusing. Some say you need to hash your PW\'s AND establish an https secure connection, others say you just

So I've read numerous articles on a password system for a web app, and they all seem very confusing. Some say you need to hash your PW's AND establish an https secure connection, others say you just need to hash AND salt your PW's.

I just know, after this has been done millions of times, there's PROBABLY some sort of library out there that can do a bunch of things for me for a password inputted on a client side, and give me something to save securely in my SQL Server 2008 databa开发者_如何学JAVAse.

Do I need to worry about all the https secure connection stuff? Can I just make sure I hash the PW correctly? To hash it, do I need any external libraries or can I create a secure user/pw system entirely in .NET?

I've never done this before so any articles, tips, links would be very helpful. Thanks.


If you don't want to roll your own you can always use ASP.Net Membership

ASP.NET membership gives you a built-in way to validate and store user credentials. ASP.NET membership therefore helps you manage user authentication in your Web sites. You can use ASP.NET membership with ASP.NET forms authentication by using with the ASP.NET login controls to create a complete system for authenticating users.

ASP.NET membership supports facilities for:

  • Creating new users and passwords.

  • Storing membership information (user names, passwords, and supporting data) in Microsoft SQL Server, Active Directory, or an alternative data store.

  • Authenticating users who visit your site. You can authenticate users programmatically, or you can use the ASP.NET login controls to create a complete authentication system that requires little or no code.

  • Managing passwords, which includes creating, changing, and resetting them . Depending on membership options you choose, the membership system can also provide an automated password-reset system that takes a user-supplied question and response.

  • Exposing a unique identification for authenticated users that you can use in your own applications and that also integrates with the ASP.NET personalization and role-management (authorization) systems.

  • Specifying a custom membership provider, which allows you to substitute your own code to manage membership and maintain membership data in a custom data store


Configuring an ASP.NET Application to Use Membership


There's also a project on github called Membership Starter Kit for MVC


The default MVC3 Internet Application template (file-new project) has this setup for you already, simply add [Authorize()] to the controllers/methods you want to protect. Don't roll something new, use what's there for you. In addition, please use SSL as someone can easily steal a session by sniffing traffic and simply using your cookie. It's that easy.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号