Authentication in ASP.NET with Identity Server 4 | Tutorial Part 2

Опубликовано: 01 Январь 1970
на канале: Code with Julian
30,148
588

We are going to add authentication and authorization to a Blazor Server app with IdentityServer4. The aim of this tutorial is to simplify the process of securing a Blazor application, showing how we can easily generate JWT tokens and restrict user access based on their authentication state.

👉Join our bi-monthly email club: https://signup.codewithjulian.com
🎉Check Out Further Resources: https://codewithjulian.com
👍If you enjoyed this tutorial, please like this video consider subscribing for more content like this!
😎Subscribe for endless .NET Tutorials:    / codewithjulian  

By the end of this tutorial, you will be able to:
Setup a new Blazor Server application
Manage components within a Blazor Server project
Setup JWT Token Authorization within a .NET 6 Web API
Configure Authentication within a Blazor Server application
Configure JWT Token Generation for each http request
Secure a Blazor Server application with OpenIdConnect
Redirect users to the login page if they are not authenticated

Source code: https://github.com/iulianoana/CoffeeS...
Slides: https://resources.codewithjulian.com/...
Steps:
Part 3 - Setting up the Blazor Server (Client) project
1. Setup a new Blazor Server project
2. Add a new Blazor Component
3. Setup IdentityServer4 Authorization within the API
Install-Package IdentityServer4.AccessTokenValidation -Version 3.0.1
4. Setup the Blazor Server for JWT Generation
Install-Package IdentityModel -Version 5.2.0
5. Add a Bearer Token to a Http Request
6. Secure Blazor Server with IdentityServer4 (Authorization)

Part 4 - Secure the Client app with IdentityServer4
7. Setup Authentication and OIDC (Client)
Install-Package Microsoft.AspNetCore.Authentication.OpenIdConnect -Version 6.0.1
Install-Package Microsoft.AspNetCore.Components.Authorization -Version 6.0.1
8. Add a Login and Logout Razor pages
9. Add Login Redirect Blazor Component
10. Setup App.razor to enable Authorization
11. Show/Hide the NavMenu items based on Authorization
12. Authorize a Blazor component

Useful Links:
Complete playlist:    • Authentication and Authorization with...  

0:00 - Intro
01:10 - Components of this tutorial
07:02 - Setup a new Blazor Server project
10:38 - Add a new Blazor Component
16:41 - Setup IdentityServer4 Authorization within the API
21:50 - Setup the Blazor Server for JWT Generation
30:53 - Add a Bearer Token to a Http Request
36:20 - Secure Blazor Server with IdentityServer4 (Authorization)
37:50 - Setup Authentication and OIDC (Client)
41:40 - Add a Login and Logout Razor pages
47:21 - Add Login Redirect Blazor Component
49:57 - Setup App.razor to enable Authorization
51:09 - Show/Hide the NavMenu items based on Authorization
53:34 - Authorize a Blazor component

Credits:
Many thanks to Kevin Jones from Rock Solid Knowledge and his comprehensive tutorial series on IdentityServer.
Sound effects obtained from https://www.zapsplat.com
Icons designed by http://www.freepik.com and https://www.flaticon.com/
Images from the artists on https://unsplash.com/


Смотрите видео Authentication in ASP.NET with Identity Server 4 | Tutorial Part 2 онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Code with Julian 01 Январь 1970, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 30,14 раз и оно понравилось 58 людям.