Web API token based authentication example C# step by step | Asp.Net Core
40.3 هزار بار بازدید -
3 سال پیش
-
In this video I have
In this video I have shown Web API token based authentication step by step using asp.net core 3.1.
JWT (JSON Web Token) is a very common format of token-based implementation. It is so popular right now that it has become a de-facto standard for token-based authentication.
JWT token has 3 parts.
Header - Header gives the information about the algorithm used
Payload - this will have claims information
Signature - A hash to validate ASP.net Core JWT token.
-------------------------------
To implement it programmatically, we have to create a Token provider in our asp.net core web api project and use a private key to generate the token. User provides the credentials and the token manager validates them and provides a JWT token if the user name and password are correct. In subsequent requests, client sends the JWT token back to the asp.net core web api application and based on the provided token, asp.net core application validates and returns the response if the token is valid.
We can give different parameters to asp.net core web api JWT token validation parameters.
SaveToken - If it is set to true saves the token Authentication properties and we can retrieve it using HttpContent.
ValidateIssuer - Multiple asp.net core web api applications can generate same JWT tokens, so If it is set to true and add the Issuer details, asp.net core web api uses these details to validate the token.
----------------------------
Below are the list of chapters
00:00 Introduction
00:26 JWT Token Architecture Diagram
01:28 Creating Asp.net Core Web Api Project
03:27 Adding logic to JWTTokenManager
08:35 Modifying Startup.cs
12:35 Creating/Modifying Controllers
14:46 Running Asp.net Core Web API appliction
16:35 JWT Token Parameters explanation
Buy Me A Coffee - www.buymeacoffee.com/azureteachnet
3 سال پیش
در تاریخ 1400/07/25 منتشر شده
است.
40,338
بـار بازدید شده