.NET 6 Web API Authentication | Minimal API & Swagger (CRUD)

preview_player
Показать описание
In this tutorial we’ll create a .NET 6 Web API (Minimal API) that will enforce JWT Authentication and Authorization. Furthermore, we’ll add Swagger support and configure Bearer Authentication for it, so that all of our endpoints can be testable from Swagger UI using a bearer token.

By the end of this tutorial, you will know:
- How to create a Minimal API project
- Create and use Data Transfer Objects
- Create Services that expose data
- Understand the basics Minimal API in .NET 6
- Setup a CRUD .NET 6 Web API (Minimal API) that will expose services methods
- Configure the API Endpoints for Authentication and Authorization with JWT Bearer
- Setup Swagger support and configure bearer authentication with Swagger
- Understand the basics of Swagger Documentation in .NET 6

👍If you enjoyed this tutorial, please like this video consider subscribing for more content like this!

0:00 - Intro
0:21 - Create Minimal API Project
1:02 - Add Data Transfer Objects
2:47 - Add Data Repositories
4:59 - Creating Services
11:09 - Install JWT Dependencies
12:17 - Configure Minimal API Endpoints
20:41 - Add Swagger Support
23:30 - Add JWT Authentication
29:03 - Generate JWT on Login
35:05 - Configure Endpoints for Authentication
38:27 - Configure Bearer Authentication in Swagger
43:43 - Swagger Documentation

Useful Links:
Dependencies:
- Microsoft.AspNetCore.Authentication.JwtBearer --version 6.0.0
- Microsoft.IdentityModel.Tokens --version 6.14.1
- System.IdentityModel.Tokens.Jwt --version 6.14.1
- Swashbuckle.AspNetCore --version 6.2.3

Credits:
Рекомендации по теме
Комментарии
Автор

Need someone to make a JulianAI wrapper that will whip out tutorials for anything I need to learn about

Quick and to the point at every step but includes details about the purpose of pretty much every line of code. Perfect style of tutorial videos!

mattpickel
Автор

I learned more in this 45min video than multiple videos spanning hours in total. Straight to the point and no missing or vague info. Thank you 😀

mrs.brightside
Автор

The Subscribe overlay ist much better than interrupting the video. Once again, thank you so much for this high quality information.

TheOnlyDominik
Автор

I like your style. You are clear and fast. You also tackle very recent topics. Keep up the good work.

AhmedAbdulla
Автор

You are rapid and straight to the point - the best method I meet so far. "Tim Corey" is way behind your style.

victorburca
Автор

I am honored that you chose me as the admin example.

LukeAvedon
Автор

In simple words and to the point great teaching style I've learnt a lot and also understood the complete flow of JWT token, authentication and authorisation role based

durdarshivirus
Автор

I really like your fast and compact tutoring.

GaleAnders
Автор

For anyone having issues with this, make sure you install the exact versions of the dependencies because there is an issue with the updated ones. Thanks Julian

Flameoflove
Автор

Very clear and easy to follow... but in the end, did you have to run? Felt like 1 minute was cut off

Lazzerman
Автор

Backend made simple.
This is just what I needed.
Thanks, Julian!

victorchidi
Автор

Great work very well explained with simplicity. Keep it up!!

rajkumararora
Автор

Excellent thank you... although I had to give the James Bond movie a rating of 3!! :)

AthelstanEngland
Автор

Very good man ! You deserve many more subscribers

rastapoile
Автор

Hi Julian, this tutorial has been very helpful for me.
I have suggestions for you, in minute 11:09 you add the dependencies and don't explain why, also you do the same thing in minute 14:00 when you add "AddEndpointsApiExplorer" just for no reason.
I'm a experienced developer and I know what that means, but think like a beginner.
Better than do is to understand 😀

eduardocarvalho
Автор

Thank you very much Julian for the excellent topic.
Please keep on doing the excellent and valuable series.
Best Regards.

talkathiriify
Автор

Why you didn't do a controller? That way the example can help people to build something they really need

jhonhernandez
Автор

is it normal practice to have all these functions in a program.cs file or is there a way it could be done in different files?

thompa
Автор

That was all great fast track. I liked it all the way. How you could make it even better is add some short explanations on complex parts where you just said instead "because ... this is how you do x" like with Bearer Swagger authentication part. This could be just shown as complete batch of code for a few seconds instead of typing as there is no explanation on it whatsoever.

mrget
Автор

BTW, how are you adding code to your project one line at a time? We don't see you typing, and that's a good thing.

AhmedAbdulla
welcome to shbcf.ru