ASP.NET Core - Roles vs Claims vs Policy

Поделиться
HTML-код
  • Опубликовано: 27 ноя 2024

Комментарии • 141

  • @RawCoding
    @RawCoding  Год назад

    UPDATED VIDEO: ruclips.net/video/W5T6713KRzg/видео.html

  • @far-red
    @far-red 4 года назад +3

    At 9:15, i totally got the roles and policy concepts, i immediately git pull the solution, tested and understood, code is nice and clean.
    i was looking for this, and this really really helped, thanks.

  • @TakuCoding
    @TakuCoding 5 лет назад +131

    Best intro lol

    • @RawCoding
      @RawCoding  5 лет назад +1

      Rhank you, I try my best ))

    • @ManuelBasiri
      @ManuelBasiri 5 лет назад +1

      Very original. Really liked it. Keep up the good work good dude.

    • @RawCoding
      @RawCoding  5 лет назад +1

      Thanks) glad you liked it

    • @viktorbelousov640
      @viktorbelousov640 4 года назад +1

      comment just for pay respect) Thank you for the video!

    • @RawCoding
      @RawCoding  4 года назад

      Thank you for watching)

  • @mistrykam
    @mistrykam 2 года назад +1

    Great explaination! The diagrams showing the difference between role (binary) and claims (key/value) and how it's related to policy (permission) was really helpful.

  • @AssasinsCreeper
    @AssasinsCreeper 4 года назад +1

    I had to watch this video a couple of times and read differets documentatons on this subject. But now, days later, I've finally understood! Many thanks!

    • @RawCoding
      @RawCoding  4 года назад +1

      Glad you got it! Nice avatar as well )

    • @AssasinsCreeper
      @AssasinsCreeper 4 года назад

      ​@@RawCoding I see you are a man of culture

  • @shenbrgd
    @shenbrgd 4 года назад +13

    Very informative. Love the intro 😂

  • @Suncircle2011
    @Suncircle2011 4 года назад +3

    Thank you, man! Finally I’ve got it. Msdn documentation doesn’t make it clear, and you do.

  • @jmahachi
    @jmahachi 3 года назад +3

    Awesome tutorial. Really clears up things. Thank you...

    • @RawCoding
      @RawCoding  3 года назад

      Thank you for watching

  • @trash2trash
    @trash2trash 3 года назад +1

    SuperB! nice abstraction demonstration :)

  • @mieto5545
    @mieto5545 5 лет назад +5

    Thank u vvvvery much!!!! I am a new programmer but there is few tutorial on this newest version of Asp.net core 2.2 MVC. I have just been confusing for a long time on what you made in this tutorial . It really helps!

  • @rezameshksar503
    @rezameshksar503 4 года назад +1

    I gave my like in the first second of the video. Great intro

  • @bahmanasheghi
    @bahmanasheghi Год назад

    the grand entry was awesome :)

  • @nobudy_left
    @nobudy_left Год назад

    best intro ever

  • @taraspelenio8259
    @taraspelenio8259 4 года назад +1

    Great explanation as well

  • @josephcoyle8126
    @josephcoyle8126 2 года назад +1

    I was immediately hooked once I heard that intro track!

  • @lessel7517
    @lessel7517 4 года назад +1

    Intro sound effects are Hollywood level

  • @anikovarkonyi2419
    @anikovarkonyi2419 4 года назад +1

    Best video, thanks a lot I could finally understand these 3!

  • @christianrazvan
    @christianrazvan 3 года назад +1

    Good intro!

  • @TriPham-id7jo
    @TriPham-id7jo 2 года назад

    Great video!

  • @priyanshu4016
    @priyanshu4016 3 года назад +1

    best start :)

  • @baoshenyi
    @baoshenyi 5 лет назад +1

    Roles are required:
    a) admin has access functions
    b) not admin has no access to functions
    Claim = Role + other business rules (complicated authorization)
    a) admin + 5 years employee has access functions
    Policy : use Claim to apply the authorization, which could make claim easy to be coded

    • @baoshenyi
      @baoshenyi 5 лет назад +1

      Is this a good way to understand it? If authorization is complicated, role will be chosen and without policy?

    • @RawCoding
      @RawCoding  5 лет назад +3

      I think you understand Roles correctly.
      Claims are not specific to Authorization but rather they define a user, You can then take a step to use the user definition to apply authorization using policies.
      Hope this helps.

  • @dmitrypopov501
    @dmitrypopov501 2 года назад +1

    Thanks very much.

    • @RawCoding
      @RawCoding  2 года назад

      Thank you for watching

  • @aj.arunkumar
    @aj.arunkumar Год назад

    very awesome video... thanks man..!!

  • @aikidoshi007
    @aikidoshi007 4 года назад +1

    Brilliant! Well done, thanks!

  • @sammygimnyigei
    @sammygimnyigei 5 лет назад +1

    Impressive!!!! thanks for the video

    • @RawCoding
      @RawCoding  5 лет назад +1

      Glad you enjoyed it!

  • @yogeswarank
    @yogeswarank 3 года назад +2

    Thank you very much. Can you also make a video on how to change the user claim after the user is logged in. Need a flexibility to refresh the claims of the user without asking him to log out and login again.

    • @RawCoding
      @RawCoding  3 года назад +1

      Use IClaimsTransformer

    • @yogeswarank
      @yogeswarank 3 года назад +1

      @@RawCoding Thanks for your suggestion. I tried the IClaimsTransformation earlier. The modified claims under TransformAsync works only for the current controller and doesn't work when redirecting to another controller. I'm using cookie authentication in .Net Core 3.1. Do I need to do anything additionally for IClaimsTransformation to work for subsequent requests to work with new claims.

    • @RawCoding
      @RawCoding  3 года назад +1

      Watch episode 3 or 4 of my auth series I explain how to use it there.

  • @gasletel
    @gasletel 5 лет назад +1

    Thumbs up for the intro

  • @esnatzea
    @esnatzea 4 года назад +1

    Nice intro bro!

  • @albertogalvan3425
    @albertogalvan3425 3 года назад +1

    awesome!

  • @govindsaini5600
    @govindsaini5600 5 лет назад +2

    Intro sound great.

    • @RawCoding
      @RawCoding  5 лет назад

      Hahha still cracks me up

  • @TheZohan-777
    @TheZohan-777 5 лет назад +1

    great tutorial, thank you!

  • @edward_t450
    @edward_t450 4 года назад +1

    Nice vídeo, Nice Channel. Alrewdy subscribed

    • @RawCoding
      @RawCoding  4 года назад

      Thank you! Don't forget to join the discord server!

  • @ibknl1986
    @ibknl1986 4 года назад +1

    Good video

  • @akbare-z815
    @akbare-z815 3 года назад +1

    dope intro

  • @hadibazmi6340
    @hadibazmi6340 3 года назад

    love the them song:D

  • @samlama6223
    @samlama6223 3 года назад +1

    Hello great tutorial, but quick question IAuthorization filter to validate claim for controller, but does it validate TokenValidationParameters?

  • @abdelkrimbournane7332
    @abdelkrimbournane7332 4 года назад +3

    Hello, thanks for the tutorial.
    I want to ask you : what's the difference between a claim and any other field in the user table (if we extends IdentityUser table) thank you.

    • @RawCoding
      @RawCoding  4 года назад +1

      Claim goes in the ClaimsPrincipal object, the others are just properties on the User object

    • @abdelkrimbournane7332
      @abdelkrimbournane7332 4 года назад

      I got it thanks, I should've finished the video before asking the question. Great content, thank you

  • @khusravkholmatov3667
    @khusravkholmatov3667 4 года назад +1

    Thanks

    • @RawCoding
      @RawCoding  4 года назад +1

      Thank you for watching

  • @codecorn6069
    @codecorn6069 4 года назад +1

    Hi. I have a question about "YearWorkedFilter" class in "YearsWorkedAttribute.cs" file. how Year property get value? in constructor, there is a [ Years = years; ] but how we get years at all?

    • @RawCoding
      @RawCoding  4 года назад

      at 13:33 you can see we pass the value in the constructor (therse no 'new' keyword), github.com/T0shik/rolesvsclaimsvspolicy/blob/master/Claims/PolicyHandlers/YearsWorkedHandler.cs here's the class you can see we set year to Year.

  • @PerryCodes
    @PerryCodes 3 года назад +1

    IsAdmin claim vs Admin role… I still don’t have a clue what the pros and cons are and what situation each might be best used in…

    • @RawCoding
      @RawCoding  3 года назад

      Claims describe a user, Roles are just claims with an extra layer. So just use claims really

  • @vandeljasonstrypper6734
    @vandeljasonstrypper6734 5 лет назад +1

    Hi man, In the new ASP.NET CORE
    the parameter of the controller can seem to read the Json object from the body of POST REQUEST from postman or nightingale
    Did you recently encounter this before ?

    • @RawCoding
      @RawCoding  5 лет назад

      If the http method is POST and the body of the request contains text that happens to be json, the dotnet core [FromBody] attribute will try to model bind that json to your model. It doesn't matter where the request is coming from. This has been working since v1 I think.

    • @vandeljasonstrypper6734
      @vandeljasonstrypper6734 5 лет назад +1

      @@RawCoding I fixed it, turn out I remove the object and just throw the attributes to it and it automatically work. I have struggle all day with it

    • @RawCoding
      @RawCoding  5 лет назад

      Good job.

  • @workcompe-bill4780
    @workcompe-bill4780 Год назад

    Please redo this presentation. I've only found your channel a few days ago and I've watched many of your presentations. Wow! You have one of the most well articulated and thought-out set of videos but this one got away from you. You are all over the place. Although I understood the content and it made sense, I personally have struggled with staying focused. It was as if you were uncertain, disconnected, or at best you were forced into doing this video and didn’t want to. It very much seamed like you were an amateur that you are most certainly not! I am a loyal fan now, but not of this particular production.

    • @RawCoding
      @RawCoding  Год назад +1

      Good shout I’ll remake it, thank you.

    • @RawCoding
      @RawCoding  Год назад

      video will be up next week.

  • @martink4975
    @martink4975 4 года назад +1

    I know this is an old video, but this one was one of the better once on the subject. Something clicked when you described policies as functions, which made me wonder about a scenario.
    If you have a Blog site and want to limit the amount of blogs a user can create, would you use a claim with a policy to check if the max limit has been reached on CreateNewBlog action (get/post) ? OR would you do something simpler like checking the DB when the user is inside the CreateNewBlog action ?

    • @RawCoding
      @RawCoding  4 года назад +1

      Thank you, and you'd check the db no need to store it as claim. And in my auth series, (episode 3 or 4 I think) I explain how dotnet core provides resource based authorization.

    • @martink4975
      @martink4975 4 года назад +1

      @@RawCoding Amazing! I hope i can repay the time and effort you put into your educational content, just got to get that full stack job. thx again and have a wonderful weekend my man.

    • @RawCoding
      @RawCoding  4 года назад +1

      @@martink4975 thank you man, don't forget to wash your hands

  • @RagdollRocket
    @RagdollRocket 5 лет назад +1

    intro gave me superpowers. and a slight headache =)

    • @RawCoding
      @RawCoding  5 лет назад +2

      Hahaha well balanced

  • @realliveone
    @realliveone 4 года назад +1

    If you weren't scrolling like a maniac when showing the code, I would know what's in it.

    • @RawCoding
      @RawCoding  4 года назад

      lol, gotta go fast man! source code is available :)

  • @abhikale3946
    @abhikale3946 Год назад

    😘😘 your intro...

  • @mohammadkheder8994
    @mohammadkheder8994 4 года назад +1

    thank you . if i create new role on runtime , how i can give this new role permission on specefic method at runtime.

    • @RawCoding
      @RawCoding  4 года назад

      It's a complicated thing to make, I can't explain in a comment.

    • @mohammadkheder8994
      @mohammadkheder8994 4 года назад +1

      @@RawCoding thank you ,do you know vedio explain this ?

    • @RawCoding
      @RawCoding  4 года назад

      @@mohammadkheder8994 No, it takes time and skill to properly implement what you are asking for.

  • @marvincorreia2040
    @marvincorreia2040 3 года назад +1

    God damn nice intro kkk

  • @psalterynbass
    @psalterynbass 5 лет назад +2

    Where is the git repository?

    • @RawCoding
      @RawCoding  5 лет назад

      Thank you for watching the video, link to the git repo is in the description

  • @kinggoncalo1587
    @kinggoncalo1587 3 года назад +1

    Can u tell me whats the password for the admin ?

  • @isnakolah
    @isnakolah 3 года назад +1

    A like for the intro 🤣🤣🤣🤣🤣

  • @demiryasinoruc
    @demiryasinoruc 5 лет назад +2

    Like for first 10 seconds

  • @yuhechen7258
    @yuhechen7258 4 года назад +1

    Congratulate everyone who come across this video.

    • @RawCoding
      @RawCoding  4 года назад

      Thank you everyone for watching!

  • @sammygimnyigei
    @sammygimnyigei 5 лет назад +1

    i hope ill find a video on third party accounts by you

    • @RawCoding
      @RawCoding  5 лет назад

      Hey what do you mean third party accounts? You mean external authentication?

    • @sammygimnyigei
      @sammygimnyigei 5 лет назад +1

      @@RawCoding yes OAuth facebook,twitter etc

    • @RawCoding
      @RawCoding  5 лет назад +1

      @@sammygimnyigei yes I. Will be covering that including identity server.

    • @sammygimnyigei
      @sammygimnyigei 5 лет назад

      @@RawCoding imm looking forward to it

  • @wisnu7734
    @wisnu7734 3 года назад +1

    Hi...just advice...i'm from asia..my english is not that good..so please talk slowly and using easy vocabulary on the next video...🙏🙏🙏

  • @LienNguyen-vq1qv
    @LienNguyen-vq1qv 2 года назад +1

    the video image is too poor, you need to fix it more

  • @craige7485
    @craige7485 4 года назад +1

    Could you please give me this code. I need it for a school project.

    • @RawCoding
      @RawCoding  4 года назад +1

      Did you check the description?

  • @nemanjacvetkovic3003
    @nemanjacvetkovic3003 3 года назад +1

    I've learned a lot from you videos. Thanks.
    But this one is you worst video sorry.

    • @RawCoding
      @RawCoding  3 года назад

      Oh yea it was made long time agon

  • @hidaya1538
    @hidaya1538 2 года назад

    The into hhhhhhhhhhhhhhhhhhh

  • @absmand
    @absmand 3 года назад +1

    downvoted due to intro.

    • @RawCoding
      @RawCoding  3 года назад

      Sad you feel that way

  • @ahmmedisthebest
    @ahmmedisthebest 4 года назад +2

    Oh man I disliked because of the first seconds
    You deal with nervous viewers because they have problems to solve. They need something clear, organized, and formal, not this low American behavior.

    • @RawCoding
      @RawCoding  4 года назад +3

      Nervous viewers? You come to this video when you have time to study not when it’s crunch time. And low American behaviour? Seriously? Sorry high and mighty Ahmed’s Tutorials.

    • @ahmmedisthebest
      @ahmmedisthebest 4 года назад +1

      it's not about me and whether i have time or not this is supposed to be technical video and its intro is not this is it

    • @RawCoding
      @RawCoding  4 года назад +3

      So this is to uphold the “technical ideology” standards for witch you’ve invented yourself. Not saying this video is done to a high standard but a lot of good educational content is fitted with silly jokes.