Duration 1:2:44

Identity with Identity Server 4 | Tutorial Part 1

64 220 watched
0
1.2 K
Published 10 Jan 2022

In this tutorial I will show you how to Configure ASP.NET Identity with Identity Server 4. The aim of this tutorial series is to ease up the Authentication process and provide a clear step-by-step process on how to secure your web applications. The entire tutorial will be done in .NET 6 and Blazor. 👉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: /c/CodewithJulian By the end of this tutorial, you will: - Be able to integrate ASP.NET Identity with IdentityServer4 - Understand the components of a fully-secured .NET 6 application - Understand the installation process for an IdentityServer4 project - Be able to install the dependencies necessary for IdentityServer4 Source code: https://github.com/iulianoana/CoffeeShopper-IS4 Slides: https://resources.codewithjulian.com/vid-aspnet-identity-is4-p1 Steps: Part 1: Setup the API 1. Create a new ASP.NET Core Empty project 2. Setup a ClassLibrary project for the Database - Install-Package Microsoft.EntityFrameworkCore.SqlServer -Version 6.0.1 - Install-Package Microsoft.EntityFrameworkCore.Tools -Version 6.0.1 3. Add and Migrate an entity with EntityFramework Core 4. Add a CoffeeShop Service and Model 5. Create and Register API Controller (CoffeeShop) 6. Add CoffeeShops to the Database 7. Register the Service in Program.cs Part 2 - Setting up the Identity Server (Server) project 8. Add an empty ASP.NET Web Project to the Solution 9. Install IdentityServer4 Dependencies (written bellow so you can just copy-paste them in your package manager console in the Server project) Install-Package IdentityServer4 -Version 4.1.2 Install-Package IdentityServer4.EntityFramework -Version 4.1.2 Install-Package Microsoft.EntityFrameworkCore.Tools -Version 6.0.1 Install-Package Microsoft.EntityFrameworkCore.SqlServer -Version 6.0.1 Install-Package Microsoft.AspNetCore.Identity.UI -Version 6.0.1 Install-Package IdentityServer4.AspNetIdentity -Version 4.1.2 Install-Package Microsoft.AspNetCore.Identity.EntityFrameworkCore -Version 6.0.1 10. Add Connection String to appsettings.json 11. Configure Program.cs 12. Create IdentityServer migrations (Default project: Server) 13. Update the IdentityServer Databases 14. Add ASP.NET Identity to the Server project 15. Add ASP.NET Identity migrations (Server proj) and run them Add-Migration InitialAspNetIdentityMigration -Context AspNetIdentityDbContext Update-Database -Context AspNetIdentityDbContext Discovery Document: https://localhost:5443/.well-known/openid-configuration 16. Add IdentityServer4 Configuration and SeedData - Seed.cs template: https://github.com/IdentityServer/IdentityServer4/blob/main/src/EntityFramework/migrations/SqlServer/SeedData.cs - Config.cs template: https://github.com/kevinrjones/SettingUpIdentityServer/blob/master/step-by-step-demo/identity/IdSWithIdentity/Config.cs 17. Setup the IdentityServer Seeding process - dotnet run Server/bin/Debug/net6.0/Server /seed --project Server 18. Setup the IdentityServer authentication flow - https://github.com/IdentityServer/IdentityServer4.Quickstart.UI 19. Update IdentityServer QuickStart code 20. Setup Program.cs for integration with the QuickStart code (Server) Useful Links: Identity Article: https://docs.microsoft.com/en-us/aspnet/core/security/authentication/identity?view=aspnetcore-6.0 - Playlist: /playlist/PL1EYnCfHLswwOz77bgfFbFqRnY3bXYHp3 0:00 – Intro 0:50 – Components of this tutorial 4:03 - Create a new ASP.NET Core Empty project 6:09 - Setup a ClassLibrary project for the Database 13:32 – Add and Migrate an entity with EntityFramework Core 20:00 - Add a CoffeeShop Service and Model 24:11 - Create and Register API Controller (CoffeeShop) 25:57 - Add CoffeeShops to the Database 27:49 – Register the Service in Program.cs 29:18 - Add an empty ASP.NET Web Project to the Solution 31:03 - Install IdentityServer4 Dependencies 32:23 - Add Connection String to appsettings.json 32:50 - Configure Program.cs 35:48 - Create IdentityServer migrations 37:47 - Update the IdentityServer Databases 38:55 - Add ASP.NET Identity to the Server project 41:55 – Add ASP.NET Identity migrations 44:33 - Add IdentityServer4 Configuration and SeedData 51:41 - Setup the IdentityServer Seeding process 55:49 - Setup the IdentityServer authentication flow 56:53 - Update IdentityServer QuickStart code 01:01:42 - Setup Program.cs for integration with the QuickStart code 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/

Category

Show more

Comments - 92