Codewrinkles
Codewrinkles
  • 391
  • 1 856 548
ASP.NET Core WebAPI Authentication And Authorization Made EASY
Join this channel to get source code access and other perks:
ua-cam.com/channels/yTPru-1gZ7-4qblcKM0TiQ.htmljoin
Authentication and Authorization in an ASP.NET Core WebAPI using JWT Bearer is something many people fear, because it seems very complicated. Not anymore! This video is your ultimate guide to ASP.NET Core Authentication and Authorization. We'll understand how to leverage the power of Microsoft AspNet Core Identity and the default authorization engine by implementing our own authentication endpoint. While doing this we'll understand how to generate JWTs in .NET, how can we work and persist claims and roles, so that we can use them for authorization purposes. Last but not least, we'll see how easy it is to perform role based authoirzation in ASP.NET Core.
Content:
1. Intro: 00:00
2. JWT settings: 02:40
3. Options Pattern: 04:38
4. Generating JWTs: 05:56
5. IdentityDbContext: 08:45
6. Configuring JWT Authentication: 10:35
7. Configure Auth in Swagger: 15:31
8. User registration: 17:23
9. User login: 23:35
10. Role-based authorization: 25:49
11. Testing it all out: 28:00
Переглядів: 2 019

Відео

Microservices Are Evil - Live Podcast with Bulent Karaahmed
Переглядів 1,3 тис.14 днів тому
Everybody pitches microservices nowadays. Truth is, microservices are evil and thos who pitch them usually don't tell you the whole story. During my recent trip to Sofia, I sat down with Bulent Karaahmed (Technical Director at Amdaris) and discussed why microservices are evil and why starting with a monolith is in 90% of the cases the best way to go. We cover topics like microservices communica...
Azure Service Bus Queue vs Topic EXPLAINED
Переглядів 812Місяць тому
#Azure Service Bus is a great tool to implement asynchronuous messaging in your systems. But what's the difference between Azure Service Bus Queue and Topic? You might be surprised, but a lot of people fail to unuderstand it. Not anymore! In this video I'll show you a simple and practical setup that showcases the difference between Azure Service Bus Queue and Topic. Bot only that. I also give s...
Practical Write-Ahead Logging In DIstributed Systems
Переглядів 1,1 тис.Місяць тому
One of the major problem with distributed systems nowadays is that we usually work with very high level abstractions and we don't understand anymore how a distributed system is supposed to work, what challenges do we have and what patterns of distributed systems we can use to overcome them. In this video I dive deeper into the concept of write-ahead logging in distributed systems. What problems...
Numeric data types
Переглядів 6393 місяці тому
Join this channel to get source code access and other perks: ua-cam.com/channels/yTPru-1gZ7-4qblcKM0TiQ.htmljoin Content: 1. Intro: 00:00
Introduction To Data Types And Variables (For Absolute Beginners)
Переглядів 4583 місяці тому
Data Types and Variables are a fundamental topic of programming in general. If you are e beginner, this video is the last one you need to watch about data types and variables in programming! Join this channel to get source code access and other perks: ua-cam.com/channels/yTPru-1gZ7-4qblcKM0TiQ.htmljoin Content 1. Intro: 00:00
How To Add Google Authentication To Blazor SSR
Переглядів 2,3 тис.3 місяці тому
Implementing Google Authentication in Blazor is something that you might need to do sooner rather than later. So, Codewrinkles got you covered! In this video we dive into understanding the authentication flow when it comes to external identity providers. We start really from scratch, by showing you what exactly you need to configure in the Google Developer Console to establish a trust relations...
Introduction To Blazor Authentication in .NET 8
Переглядів 10 тис.3 місяці тому
Blazor Authentication can be a tricky subject in .NET 8. The reason for this is that authentication has drastrically changed when compared to how we implement it in earlier versions, no matter if Blazor WebAssembly or Blazor Server. Therefore in this video my aim is to walk you through what has changed and explain you exactly how authentication works in Blazor in .NET 8. We'll also tackle some ...
Here's WHY You Struggle With Software Architecture!
Переглядів 2,5 тис.3 місяці тому
Here's WHY You Struggle With Software Architecture!
Blazor VS. NextJS Head To Head! Which One Wins?
Переглядів 5 тис.3 місяці тому
Blazor VS. NextJS Head To Head! Which One Wins?
That's NOT How Async And Await Works in .NET!
Переглядів 12 тис.4 місяці тому
That's NOT How Async And Await Works in .NET!
How CRUD Mentality Ruins Your App
Переглядів 3 тис.4 місяці тому
How CRUD Mentality Ruins Your App
The Biggest ISSUE With Blazor (and how to fix it)
Переглядів 8 тис.5 місяців тому
The Biggest ISSUE With Blazor (and how to fix it)
Escaping The .NET 8 Blazor Redirect To Login Hell
Переглядів 5 тис.5 місяців тому
Escaping The .NET 8 Blazor Redirect To Login Hell
DON'T Use DbContext In Blazor Interactive Server Components! (.NET8)
Переглядів 6 тис.6 місяців тому
DON'T Use DbContext In Blazor Interactive Server Components! (.NET8)
Everything You Need To Know About Blazor in .NET 8
Переглядів 11 тис.6 місяців тому
Everything You Need To Know About Blazor in .NET 8
Blazor Server Full CRUD Operations From Scratch Incl. EF Core
Переглядів 4,5 тис.6 місяців тому
Blazor Server Full CRUD Operations From Scratch Incl. EF Core
How To Ensure Code Quality in Your .NET Projects
Переглядів 2,5 тис.6 місяців тому
How To Ensure Code Quality in Your .NET Projects
Getting Started With .Net, Docker And Azure Container Instances
Переглядів 4,6 тис.7 місяців тому
Getting Started With .Net, Docker And Azure Container Instances
Microfrontends with Blazor
Переглядів 6 тис.7 місяців тому
Microfrontends with Blazor
This Will Make Your Repositories Obsolete
Переглядів 6 тис.9 місяців тому
This Will Make Your Repositories Obsolete
Why Do I Sponsor OSS Projects?
Переглядів 7119 місяців тому
Why Do I Sponsor OSS Projects?
Moq Uses Your Personal Information!!!
Переглядів 6 тис.9 місяців тому
Moq Uses Your Personal Information!!!
Streaming Videos From Azure Blob Storage in Blazor Server
Переглядів 2,4 тис.9 місяців тому
Streaming Videos From Azure Blob Storage in Blazor Server
Can I Run .NET 7 Minimal API in a Windows Service?
Переглядів 7 тис.9 місяців тому
Can I Run .NET 7 Minimal API in a Windows Service?
PRACTICAL Refactoring of MediatR Request Handlers
Переглядів 2,7 тис.9 місяців тому
PRACTICAL Refactoring of MediatR Request Handlers
All You Need To Know About IHttpClientFactory in ASP.Net Core
Переглядів 7 тис.9 місяців тому
All You Need To Know About IHttpClientFactory in ASP.Net Core
You Are Using HttpClient Wrong
Переглядів 3,4 тис.9 місяців тому
You Are Using HttpClient Wrong
Sharing Context Between MediatR Components
Переглядів 1,4 тис.10 місяців тому
Sharing Context Between MediatR Components
Using MediatR Pipeline Behaviors For Database Transactions
Переглядів 2,8 тис.10 місяців тому
Using MediatR Pipeline Behaviors For Database Transactions

КОМЕНТАРІ

  • @somatichuman8752
    @somatichuman8752 2 дні тому

    Most strange thing to me is when you are using IResult, the final response is wrapped in the special object with fields like: status, errors, traceId.... . So, for example lets take an implementation of pagination. The props like pageNumber and pageCount must be presented in the final response. So We have to create another level of wrappers for your response or change the IResult wrapper object. How can we put the pageNumber and pageCount prop inside IResult wrapper object?

  • @saber.tabatabaee
    @saber.tabatabaee 3 дні тому

    very usefull. very good thank you very much in this world and hope all best wishes in the future worlds

  • @MilvioLuA
    @MilvioLuA 3 дні тому

    Indeed it fixes. However, when you switch to @rendermode @(new InteractiveServerRenderMode(prerender:false)), you're indicating that you want to disable prerendering. Prerendering can sometimes cause issues with JavaScript execution because the page content is generated on the server and sent to the client before JavaScript can fully load and execute. This can lead to JavaScript code not finding elements it expects to interact with. I know you can do OnAfterRenderAsync and call your js functions there, but it can be a pain for apps that are migrating to Blazer and already have extensive javascript. This is still the best way to fix it so far.

  • @abuuthmaan
    @abuuthmaan 4 дні тому

    You're the man, Dan! This is the best tutorial on the topic I've found.

  • @3litepker
    @3litepker 4 дні тому

    I know the background music is very low but is it necessary? Also, doesn't this just make the solution more messy if you need to create a new validation class for each and every request handler when you can do it directly in there?

  • @Eirenarch
    @Eirenarch 5 днів тому

    I know that it is for the purposes of the demo but it should be noted that you don't store the FirstName and LastName in the database as claims. You might include them in the claims in the token but they definitely do not belong in the claims table in the DB.

  • @monikachavan9749
    @monikachavan9749 6 днів тому

    Is .net 5 support standard and .net core?

  • @AryaDinesh-jd5du
    @AryaDinesh-jd5du 7 днів тому

    When the page is refreshed, the issue is not resolved even though it works for the initial rendering.

  • @MetaProgrammer
    @MetaProgrammer 7 днів тому

    Thanks! Have a coffee on me!

    • @Codewrinkles
      @Codewrinkles 7 днів тому

      Thanks a lot, but it was not necessary. You already give me a coffee each month through the mebership.

    • @MetaProgrammer
      @MetaProgrammer 7 днів тому

      You've been working extra hard lately, Dan, and we all appreciate your efforts!

  • @MetaProgrammer
    @MetaProgrammer 7 днів тому

    On my side of the planet (UTC+4 USA Eastern time) I had to make a slight change in the IdentityService class, GetTokenDescriptor method for UTC expiry time. I changed "Expires = DateTime.Now.AddHours(2)," to "Expires = DateTime.NowUtc.AddHours(2)" to properly set the property greater than the creation time on TokenDescriptor return value. Great video and code! Thanks, Dan!

  • @abdokha6227
    @abdokha6227 7 днів тому

    Why not from within Visual Studio Identity Management? Everything is ready

  • @user-rs7mp6ry3u
    @user-rs7mp6ry3u 7 днів тому

    very good , can u explain use with clean architecture?

    • @Codewrinkles
      @Codewrinkles 7 днів тому

      Just stay tuned for next week :)

  • @skosuri
    @skosuri 8 днів тому

    A big thank you!!

  • @adam-xt8te
    @adam-xt8te 8 днів тому

    Your solution works great! If user types localhost:3333 it redirects him to localhost:3333/login if he's not logged in. How can I redirect him to chosen page if he's actually logged in and he types base page address e.g. localhost:3333 => localhost:3333/awesome-page?

  • @slowjocrow6451
    @slowjocrow6451 9 днів тому

    What's a good way to deal with Task.WhenAll exceptions?

  • @bojanpavlovic5038
    @bojanpavlovic5038 9 днів тому

    Great Video Dan, Thanks! Greatly explained.

  • @vesa95
    @vesa95 9 днів тому

    Fantastic video, you have a great way of explaining these things. In details, but with full clarity! Please continue the series 🎉

  • @itssalmanvlogs_
    @itssalmanvlogs_ 9 днів тому

    I am learning a lot with your videos, Thank you

    • @Codewrinkles
      @Codewrinkles 9 днів тому

      Glad to hear that! Thanks for watching!

  • @bouthaynahamdi707
    @bouthaynahamdi707 9 днів тому

    very helpful. does it work if the app service is container base?

  • @erril8285
    @erril8285 9 днів тому

    Unfortunately many people falling into the trap which is called Automapper. Stay away from that, you will be much happier, believe me.

  • @waleedbensumaidea3947
    @waleedbensumaidea3947 10 днів тому

    Would you like make videos about authentication and authorization using JWT with Blazor NET8 auto render mode This approach has many difficulties

    • @Codewrinkles
      @Codewrinkles 10 днів тому

      I probably won't do a video on this topic as I don't think it should be an approach in a Blazor app. Blazor comes with its own authentication/authorization mechanisms and we should use them. I can't really understand why people still want to stick to JWT even in the SSR world. And I'm not talking here only about Blazor, but also about NextJS, Angular Universal and so on. I think we as developers should adapt to these new ways of rendering web application and not try to apply archaic techniques to modern technology.

    • @tomaszpuwalski
      @tomaszpuwalski 4 дні тому

      @@CodewrinklesWhen making simple applications for our own use, we can choose how modern technologies we want to use. In real life, however, we often don't have this option - if, for example, we are forced to do an integration with an existing SSO, we have to adapt to its mechanisms: if it uses JWT (and this is very likely), we will also have to use JWT - even if Blazor offers a solution better tailored to its needs.

  • @itssalmanvlogs_
    @itssalmanvlogs_ 10 днів тому

    One of the best explanations, Thank you

  • @azgan123
    @azgan123 10 днів тому

    Gigachad <3

  • @SayconX2
    @SayconX2 11 днів тому

    Nice vídeo!

  • @ernanmaisels
    @ernanmaisels 11 днів тому

    Thanks Dan! In this way, dont you use EF to add tables of users in your DB?

  • @valterleimuryviana7697
    @valterleimuryviana7697 12 днів тому

    The best explanation about Blazor on the web that I think too! Congrats!

  • @visheshgrade9861
    @visheshgrade9861 12 днів тому

    Randomly saw this today, to check my understanding, covered everything in a short video. I generally don't comment, but great work 😀. Now will see more videos here 😅

  • @asiridissanayaka6849
    @asiridissanayaka6849 12 днів тому

    Very much practical and well explained.

  • @botyironcastle
    @botyironcastle 13 днів тому

    what if you have huge data like 100000000comments in Post object. I don't think you can init a domain object with that much... looks useless to me when dealing with large chuncks of data. Thoughts?

    • @Codewrinkles
      @Codewrinkles 13 днів тому

      I think that's a problem no matter if you use DDD or not. And the answer to it is sime: you don't load all data at the same time. You introduce paging or fltering based on other data poits that are important for your domain. If you take a look at literally all planet scale apps out there, you'll see that all of them use this approach

  • @FirmanHerdiansyah
    @FirmanHerdiansyah 13 днів тому

    realy enjoyed the podcast. waiting to the next modular monolith podcast

  • @igorr4682
    @igorr4682 14 днів тому

    Given your heavy accent and rapid speech, I find this video rather challenging to follow, making it less useful for me.

    • @Codewrinkles
      @Codewrinkles 13 днів тому

      Wow, that's some very constructive feedback. Thanks

  • @LE8271
    @LE8271 14 днів тому

    This is the inconvenient truth about DDD. The persistence hell. To be clear you are the only content creator who deals with updates and I fully respect that. All others (including paid trainings) does not event talk about that part as it is really tricky. Imagine a form where the user submits all changes at once. Multiple addresses, perhaps last and first name at the very same time using a single DTO in its call. That is where DDD falls apart or creates persistance very complex at least. The maintainability suffers. Today with Blazor where you do not need a DTO and you can throw in an existing object it is even trickier.

  • @adam-xt8te
    @adam-xt8te 15 днів тому

    In one of previous videos you explained using old Razor Pages to handle user authentication to Blazor Server Application is the most right method to set right cookies and handle HttpContext on initial state. Is it still actual in NET8?

    • @Codewrinkles
      @Codewrinkles 14 днів тому

      Actually. that doesn't apply to the new Blazor. Please take a look at this video where I explain what changed: ua-cam.com/video/asa2ucbZlCI/v-deo.html

  • @CarrigansGuitarClub
    @CarrigansGuitarClub 17 днів тому

    I remember about 7-8 years ago when Microservices started to gain traction, they had a mystique about them, the people doing the interviews didn't really know enough about the architecture.....spin on 7 years and they are hardly talked about ....Message Brokers are the way to go, just swapping the interface class!

  • @joaogabrielv.m328
    @joaogabrielv.m328 17 днів тому

    After a long time, the king returns Sup, Dan :)

    • @Codewrinkles
      @Codewrinkles 17 днів тому

      My absence was mostly due to the fact that I was traveling the last 3 weeks and a half. Work related. This video is one of the redults :)

  • @harrisonwell1719
    @harrisonwell1719 17 днів тому

    you lost a lot of weight

    • @Codewrinkles
      @Codewrinkles 17 днів тому

      Yep. Around 54 kg.

    • @harrisonwell1719
      @harrisonwell1719 17 днів тому

      @@Codewrinkles Let me guess, you did an operation, I mean basically cutting most of your stomach ?

    • @Codewrinkles
      @Codewrinkles 17 днів тому

      The weight loss ocurred over 10 months. I'm doing a lot of sport lately.

    • @harrisonwell1719
      @harrisonwell1719 17 днів тому

      @@Codewrinkles I know a lot of people who have done it, not the best way to lose weight especially the saggy skin after the weight loss, but you look great. Please take care of your health.

  • @arunbm123
    @arunbm123 17 днів тому

    ❤ u r brilliant

  • @arunbm123
    @arunbm123 17 днів тому

    You are brilliant no doubt ❤

    • @Codewrinkles
      @Codewrinkles 17 днів тому

      I'm not. But Bulent is :). I was glad I could have this talk with him.

  • @kirillzlobin7135
    @kirillzlobin7135 18 днів тому

    Why in C# to make an API call is such a huge deal...

  • @nahuelriquelme6250
    @nahuelriquelme6250 18 днів тому

    Genial, era lo que venia buscado hacer hace tiempo, gracias.

  • @marreborre3501
    @marreborre3501 18 днів тому

    How would you model Employees and Customers? My first thought would be to have 2 different tables that link to the User. But then how to differentiate the different users? Have a userType or maybe a Role?

  • @-elwin6539
    @-elwin6539 19 днів тому

    [DataAnnotations] above the model fields are so simple man. A declarative and intuitive way to understand whats being validated. Not only that but controllers serialized results to the client automagically out of the box. What we are doing here is perpetuating the change for change sake mantra due to the need to widen the developer base and anything but 'minimal'. At this rate .NET will complete its trip from 'object oriented' to 'functional programming spaghetti code' (current state) to....yes...Javascript.

  • @wenqingli9669
    @wenqingli9669 20 днів тому

    Great video, thanks for sharing this with us! I am wondering how we do model validation with attributes like [Required] and specify the rules on the field. Then, have the filter to check these rules. So we can see the request validation and message on the object itself rather than find out this in another file.

  • @petrucervac8726
    @petrucervac8726 20 днів тому

    Relax brother! Life is too short to get angry at LinkedIn influencers.

  • @PauIyM
    @PauIyM 21 день тому

    I keep getting an error when running the application locally and I submit a post request with the name and price. It says Executed “ProductsGetAllCreate” failed. Exception while executing function. Format of the initialization string does not conform to the specification starting at index 0.

  • @DamagedScript200
    @DamagedScript200 21 день тому

    Hei nice video, I wonder if we can put all the actions that a user can perform inside a model instead of putting it inside a service?

  • @troom6851
    @troom6851 21 день тому

    The best explanation of blazor in .NET8 I've found on the internet. Congratulations and thank you, I will definitely watch the whole series.

  • @hishamalaa6001
    @hishamalaa6001 21 день тому

    just a question I wish an answer for it I created a project using N tier Arch (I did this project following an instructor) But it wasn't like that, the models was In the data Access layer and the Abstraction repos and its implementation were in the Business Logic layer so that structure confused me weather it should be like you did or what I had did.

  • @adam-xt8te
    @adam-xt8te 21 день тому

    Your channel is pure gold. Thank you for your effort

  • @mistelltein
    @mistelltein 22 дні тому

    The video is good, an interesting topic, but it would be extremely convenient if there were links to resources For example, your telegram channel or something similar, which usually happens to others, because it is a little difficult to search. I would be extremely grateful :)