0
votes

-> I want to use Identity server 4 as a central token generator for some clients.
-> Here my problem is I have implemented Identity server 4 with the help of docs, in the docs the IS4 is using its own database for users to login.
-> Can someone explain the way to connect to my own users database for login and token generation. (I'm using the latest version of IS4 and .net core).

Thanks in advance :)

Note: I have tried all the things from docs -> http://docs.identityserver.io/en/latest/quickstarts/8_aspnet_identity.html

2
An ASP.NET Identity-based implementation is provided for managing the identity database for users of IdentityServer., from the documentation. In other words, all you need to do is replace this library with your custom code, as documented here. - user4864425
If you don't want to get into ASP.Net Identity perhaps it would help you to look at an older version of AccountController which did not use ASP.Net Identity. See github.com/IdentityServer/IdentityServer4.Quickstart.UI/blob/…. This version injects a simple user store using in memory test users. You will need to implement your own user store.. - Richard

2 Answers

2
votes

The AccountController is a starting point for you to adapt to suit your own requirements.

This template uses ASP.NET Core Identity for user management.

Your choices are

  • Migrate your users to use the Identity's table structure
  • Provide a custom storage provider to ASP.Net Identity that uses your existing user tables (Custom Storage Provider)
  • Implement your own user management\storage service and change AccountController to use it
1
votes

If you have a custom database you want to connect to, you can implement the IProfileService. IdentityServer4 uses an instance of that interface to collect user details. Docs: click