Search code examples
c#sql-serveridentityserver4

IdentityServer 4 and pre-existing SQL server databases


Is it possible to set up Identity server so that it not only looks at a SQL database when it comes to user records, but uses a pre-existing database that contains all the details? How would I go about configuring Identity Server to look at certain tables and fields within a database?


Solution

  • Yes you can implement your own IProfileService which has your UserDbContext or UserRepository injected into it. Make sure you add this service to the DI container for it to work. IdentityServer4 will your implementation of IProfileService if you do this.