2

I need simple log in functionality in my project (logged in users can access and modify their profile). I've read a book "PRO ASP.NET MVC 5" by Adam Freeman where he quickly written a simple, short and elegant login mechanism just by using authorization and authentication filters and extending from some built-in classes. However, I just checked the internet and found many completely opposite approaches using classes such as Identity and Claim and achieved by writing LOTS of code, i.e. this or this.

Is it really necessary to implement a huge framework and write many lines of code just for a simple log in approach with some security? Is it really that bad to rely on authentication and authorization filters?

Yes, I am planning on publishing my project, but it's really very small.

What would be the best and the most beneficial practice for creating a basic log in functionality?

Community
  • 1
  • 1
Salivan
  • 1,876
  • 7
  • 26
  • 45
  • the framework is not as huge as you think it is. If the code intimidates you thats a personal problem but you don't have to write any to get Identity working. It is all coded for you, all you have to do is add the entities you want related to ApplicationUser in the IdentityModel. – Kyle Bachmann May 02 '16 at 21:00
  • @KyleBachmann But is it really bad to rely on filters? And do you know any good tutorial on `Identity` topic? – Salivan May 02 '16 at 21:02
  • I personally used Youtube and trial and error, but this tutorial looks really good, lots of code bits and helpful explanations http://benfoster.io/blog/aspnet-identity-stripped-bare-mvc-part-1 – Kyle Bachmann May 04 '16 at 16:28

1 Answers1

-1

when you create asp.net mvc 5 webapp you will find asp.net-identity already exist you just have to make simple changes in the user to link it to your other entites

Ahmado
  • 58
  • 10
  • I always choose "Empty" project template, just check the "MVC" option to include MVC folders, and I'm not going to change my approach. Otherwise, your answer is really poor. – Salivan May 02 '16 at 16:57
  • Salivan, he is completely right & probably did not want to do your work for you, but was nice enough to point you in the right direction. There is a framework offered to you which gives you exactly what you want, but it won't work if "I'm not going to change my approach" is your dev standpoint. Here is a great tutorial to get started w/ ASP Identity, (which is super easy to get working) http://www.asp.net/identity/overview/getting-started/introduction-to-aspnet-identity The type you are specifically looking for is single-user authentication. – Kyle Bachmann May 02 '16 at 20:59
  • @KyleBachmann Okay, sorry, maybe I was a little too harsh on this guy. I actually examined the MVC template which includes Identity by default and it seemed pretty good and easy to customize. But talking about his answer, he could've at least provided me with some tutorials. This answer would've looked way better if it had been written as a comment. – Salivan May 04 '16 at 16:36