azure-active-directorymicroservicesasp.net-identityidentity

.NET 8 Identity Microservice using existing user credentials in database


I have a .NET Framework web application that authenticates users and authorizes user roles based on tables that exist in a sql server database instance. i am working on creating a microservices architecture to peel certain aspects of the application into a variety of different microservices for the various tasks that were all previously being handled by the monolithic application.

I would like to authenticate the requests made to the various microservices using a centralized identity microservice built in .NET 8. I have an azure active directory that manages all internal users, but there are also external users that utilize the client application and would need to be able to make requests to the various microservices based on role.

Currently, all users and roles are being stored in existing database tables. Can I leverage my existing database tables with .net identity to use the current User tables for authentication? or do we have to migrate all those users over to new tables created by .net identity in order to use that library


Solution

  • You can leverage your existing database tables with .NET Identity for authentication. In .NET Identity is flexible enough to allow you to customize the storage of user data. You can extend the existing IdentityUser class or implement your own custom user class that maps to your existing database schema. For instance you can need to implement interfaces like IUserStore<TUser> and IUserPasswordStore<TUser>. This will create a custom user store that interacts with your db tables to perform operations.