简体   繁体   中英

Get IdentityServer3 to use existing user sql database

I am trying to authenticate a user against an existing user database. I have an existing database with a users table and I want the Identity Server to look at this database and get authenticate the user.

I have found examples for MembershipReboot and AspNetIdenetity, but I am confused on how I need to create my own user database mapping.

I am not trying to create an external provider eg Facebook

Has anyone got any ideas or seen any tutorials on how this can be done?

You can implement your own IUserService, then in your startup you can set IdentityServer to use your new User Service

var factory = InMemoryFactory.Create(
    clients: Clients.Get(), 
    scopes: Scopes.Get());

var userService = new MyUserService();
factory.UserService = new Registration<IUserService>(resolver => userService);

https://identityserver.github.io/Documentation/docsv2/advanced/userService.html

EDIT: Fixed dead link

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM