简体   繁体   中英

Should I use 'IdentityUser' when I implement an authentication in ASP.NET Core MVC

I was working on implementing username and password authentication.

We didn't use any authentication templates.

And I thought IdentityUser has a lot of columnn.

Username, password, nickname are enough columns for us.

Old Method. Login API has logged user information in session.

And other controllers use it.

But I'm not sure It's right way or not in .NET Core Web dev.

Should I use IdentityUser ? or Was that method I implemented okay?

I have been developing in.Net for nearly 20 years and I still ask my self the same question. There is always the "latest and greatest" being hyped by Microsoft and other talking heads and honestly, 99% of the time what is being pushed as the "right" and "correct" thing to do is no longer "right and correct" after a few years pass.

If you asking about how you should do it in ".net core" then using the IdentityUser interface is the way to go because WHEN (not if but WHEN) Microsoft decides to scrap .NET Core (everyone can pounce on me all they want) for backward compatibility purposes they will "LIKELY" continue use of the interface.

However, Even if they do it might be 1 or 3 or 5 years until Microsoft says, NOPE. That's legacy you need to redo it.

So my answer is, without knowing all the facts, is if you have a custom implementation that suites your needs then stick with it. You aren't going to forced to change it in a few years because Microsoft decided the latest hottest open fad is the way everyone should be doing thing.

I thought IdentityUser has a lot of columnn. Username, password, nickname are enough columns for us.

Please note that the most of properties of IdentityUser in ASP.NET Core Identity system are required for user management.

I was working on implementing username and password authentication.

If you just want to implement and integrate simple authentication and authorization mechanism in your ASP.NET Core MVC app, you can try to implement and use cookie authentication without ASP.NET Core Identity.

https://docs.microsoft.com/en-us/aspnet/core/security/authentication/cookie?view=aspnetcore-5.0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM