Blazor Admin Page Tutorial (Roles, Policy, Claims)
We will be building a very simple admin page but the purpose is to teach you how to implement Polcies, Roles, Claims and use the ASP.NET Core Identity Framework in Blazor. Once you go through this you will understand how a lot of real world asp.net apps add users and their respective roles and claims to be used in a web application. This is only for Blazor Server, Blazor WASM has some differences.
GET YOUR FREE BLAZOR CHEAT SHEET HERE!!!: JustBlazor.com
Fair Use and Resources:
Chill Jazzy Hip Hop Royalty Free Jazz Hop Music
Abstract Atmospheric Background by Jorik Basovkground
Perhaps you need a bit of guidance in landing the job, passing the interview or succeeding in your Software Career? Book a session:
https://contractlancer.com/
00:00 Intro
00:55 Project Start / Creation
04:20 Dont forget to add this line
06:16 Completed the Migration of the DB model
07:00 Adding Razor Component For Admin Page
09:31 Adding User and Role Classes
12:57 Explanation of UserManager
14:35 Starting EditForm
15:29 Adding Code To AdminPage
21:10 Adding EditForm Components
23:44 AddUserWithRole function logic start
27:30 Adding Roles to DB
33:10 How to Add a User
35:17 Getting the User Role and Assinging it
38:33 Adding an Alert
40:28 Setting Authorization with Roles
45:40 Adding Policies
47:56 Adding A Claim
49:40 Authorizing with a Policy
55:09 A small test
57:55 Wrap Up