Blazor Admin Page Tutorial (Roles, Policy, Claims)

preview_player
Показать описание


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:

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
Рекомендации по теме
Комментарии
Автор

ffs, if you paste code from somewhere else just keep your screen on that for at least a few seconds instead scrolling up and down, it's a nightmare to pause the video at the right time to rewrite it...

Thydus.
Автор

Ctrl+k, Ctrl+d autoformats code in Visual Studio. I use the hell out of it.

I love your videos.

spontaneousorder
Автор

Thanks for this video. I ran into errors, but they were all my typos. Got it to all work, now I will try to do a mudblazor version of this.

netrunner
Автор

Thanks for your common sense explanation. It makes it easy to understand 👍

jimwoodman
Автор

Thanks man, your videos are saving my life, you rock

TYNEPUNK
Автор

Thank you for your video... 😀😀😀😀

Your can use "Ctrl+shift+v" for saw the all the copied data in the IDE and Just select the data and paste it.
which you doing at the 7:42

teamrospl
Автор

At around 17:15 you said if grabbing from database you must use OnIntializeAsync. Why is that?

ElCidPhysics
Автор

Amazing video thank you. Im having a problem at 39:36 when I add user it says A key cannot be configured on 'IdentityRole' because it is a derived type. The key must be configured on the root type 'IdentityRole<string>'.

TYNEPUNK
Автор

Hai, thanx for creating this video, can I download the solution somewhere?

kaatverkade
Автор

Thanks for the great videos
I hope you can make another one explaining how to deal with dynamic roles (not hard coded)

mahfoudbouabdallah
Автор

I had already started using JWT tokens and didn't want to rely on Identity magic too much. Altho I did seed custom roles and assigned them to a user. Not using the AuthStateChanged event has been the only hurdle for now but I worked around it. I can do most with custom logic, I'll use the built-in stuff next time. The thing I'm stuck on now, is how to make sure the Admin can also do what the Editor can without explicitly including the Admin role everywhere. Is it done with policies? I understand Identity can't know the hierarchy of the customly seeded roles.

fleedum
Автор

This tutorial would have been less confusing with a hosted project, by drawing a clear line between client, server, and shared.

I'm new to Blazor/ASP, coming from the world of Wordpress/Laravel, and I'm in the process of piecing together a fully functional project template (duende-less blazorwithidentity, mysql, emailsender, blazorise).

C# is my favourite language, and I think blazor is mature enough now for me to take the dive.

As a complete novice, I can almost comprehend this tutorial, but it's a bit messy seeing signin-manager code inside of a razor file.

I can't tell if this is a 'roll your own', and maybe if there's a more standard way of doing an admin page.

tubebility
Автор

Hey, I've been watching a lot of blazor server videos.

I'm working on a project, in it, I have a table that lists all the users. I want to also show the users roles in the table.

I was at first trying to use usermanager, but looping through the users to get the roles throws an exception. I imagine because it doesn't use a dbcontextfacory to access the database.

Do you know the correct way to do this?

For now I just created my own repository and method to use a dbcontextfacory and get that info. But I would like to not have to do that.

Thanks.

clsferguson
Автор

Use CTRL-K-D to format code from time to time.

dajma
Автор

Where is the discord? Also one thing I dont understand is the hardcoded password, so you make a user add a role, then how do they change their password? it would be good to know how to add a role to an existing user too, like select them from a list and add role to them. i presume you were just sort of doing it as an example. im very new to blazor but these vids are great thanks.

TYNEPUNK
Автор

Laughed at the Lady and Gentlemen intro. Know a place where i can learn what you just taught but for blazor wasm?

UnconventionalPotato