Managing Permissions With EF Core Migrations | Permission Authorization - Part 2

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

Authorization is an important topic to consider in an ASP.NET Core application. Along with authentication, it's the backbone of a reliable and secure application. In this video, I'm going to show you how to implement permission authorization. This is part 2 of a longer series on permission authorization, where we'll introduce the concepts of roles and permissions. I will show you how to configure everything with EF 7 and how to manage roles and permissions with EF migrations.

Join my weekly .NET newsletter:

Read my Blog here:

Subscribe for more:

Chapters
0:00 Defining the Role entity
2:11 Defining the Permission entity
2:52 Adding navigation properties to Role
3:43 Configuring the entities with EF
8:23 Defining RolePermission and seeding Permission per Role
11:50 Applying changes with EF migrations
Рекомендации по теме
Комментарии
Автор

Awesome, waiting for the next video of this series.

subashbarik
Автор

Awesome! Liked, subscribed)
Keep continuing to create such intensive and helpful lessons)

Mazur_Family_Travel
Автор

Amazing way to implement that Milan! From Perú 💯!

benij
Автор

What's inside the Enumeration<> class? (in Gatherly.Domain.Primitives) Is there any video that covers this?

danielle
Автор

Awesome series, bro! Keep it up! Greetings from Bulgaria 🇧🇬!

dunderball
Автор

what a clean way to implement that!
pretty interesting. thank u for this tutorial

laolaoal
Автор

Great ideas! Thank you! Looking forward for continuation! 😊

MaxSupercars
Автор

Hi Millan, I love the you structure your code and its so clean indeed, but then the more I watch the more confused I get. Is there anyway you can help by making things perhaps understandable or probably make recommendations on how to catchup.

olufeming
Автор

Really like the conversion of the enum to a new entity with key:value and the automatic seeding. I have always avoided use of enums with efcore for things like status values as I couldn't figure out a way to get the full key and value into the DB reliably. Will try to replicate this, thanks

mylesdavies
Автор

Is it better to use HasPermission attribute with IRequest query or command implementation as Jason Taylor did with Authorize attribute in clean architecture?

Tamer_Ali
Автор

Hi Milan,
I'd like to categorize the Permissions and I'll create enum for them
public enum PermissionCategory { Admins= 1, Users= 2}
should I loop the Permission enum and add PermissionCategory value as the foreign key
or create a custom attribute "say Category" with each Permission then use your way to seed permissions data?
public enum Permission
{

ManageRoles = 1,


ManageProfiles = 2
}

Tamer_Ali
Автор

Hi, First of all i wanna say that it is amazing content thanx for sharing such a great content. But there is a question that makes me think: after making our project working in production server, how we can add new permission enum? we only have to add that on code side? and after adding new permission enum we should make new migrate, how we can handle that situation with production code?

javidibra
Автор

Hi Milan, I have a question that does not fit this video (well perhaps a bit) so here it goes:
Say I want to use an external login (google, microsoft, or in my case the Blizzard API) to use some of my endpoints in an API. I want to create a frontend and a mobile app, which are both not a c# project. How would I go about sending the token that people got from the external login to the backend, and then validating/using that token without there being a security risk?
Hope my question is clear, and please keep making these awesome videos!

roefski
Автор

How do you prevent EF from trying to create a new Role (with a duplicate key) every time you save changes?

paulbarton
Автор

I have sum issuse with this lection, The collection navigation 'Role' cannot be added to the entity type 'User' because its CLR type 'Role' does not implement 'IEnumerable<Role>'. Collection navigations must implement IEnumerable<> of the related entity.

VakhushtiMetreveli
Автор

i watched your video on Enumerations but I dont find a GetValues static method there. Am I missing something?

unimatrixa
Автор

whats the Enumeration class? is it some type of custom made enums?

StressedProgrammer
Автор

I have implemented this in two projects recently, one thing that I struggled with was how to make a menu out of this permission enum and only show those menu items which the user has permission to.

bilalmehrban
Автор

Enumeration is missing please reorder videos on the series

ayedabboushi
Автор

Hi Milan,

What is the implementation for GetValue()

velkumars