I am a beginner, and I chose to learn Blazor and WebApi by NOT using the Blazor WebAssembly App with ASP.NET Core hosted (I know I could have just used the template where there is a Client, Server, and Shared projects, but I feel that I can learn better when I understand how they operate separately). Anyway, instead I did the following:
Created an empty Solution
Added a Server.WebApi project using an ASP.NET Core Web Application (API) - this is where I placed all my WebApi Controllers
Added a Lib.DataAccess project using a Class Library (.NET Standard) Targeting Framework 2.1 - this is where I placed my ApplicationDbContext.cs and Migrations Folder
Added a Lib.Entities project using a Class Library (.NET Standard) Targeting Framework 2.1 - this is where I placed my Models and ViewModels
Added a Client.Blazor project using a Blazor Web Assembly App but not ASP.NET Core hosted, and with No Authentication
So far, I was able to make everything work properly.
But now, I'd like to learn how to Add Identity Authentication in my existing solution...but I don't know how or where to begin...because I also don't really understand the concepts behind or how it works..
Inquiries:
- Can somebody please help add this to my existing project? Do I install packages on Client.Blazor and Server.WebApi? or install in Server.WebApi only?
- Can I use a separate DbContext and separate Database Schema for the Identity Authentication? Or is it proper to use a different DbContext but use the same Database Schema?
- In relation to #2, I do not know how to implement either...
- When I implement Identity Authentication, is there a way for me to select User Roles (such as System Admin, Encoder, Guest, etc...)?
- When a user is logged in (I'm kinda assuming that the user account logged in data is in the Server.WebApi), is it possible for me to retrieve user account data in the Client.Blazor project?
I apologize for asking too much here, but there's just too much information in the internet and I am kind of getting lost already...Thanks in advance for the help!