identityServer4 授权码模式 如何对接用户表
identityServer4 授权码模式
在网上看的例子都是测试数据,或者是新建的User表。
我现在有User表,如何对接到上面,与客户端输入的账户密码进行验证
回答
框架后面的数据库, 用户表等都是可以替换的, 参考文档:
https://identityserver4.readthedocs.io/en/latest/topics/signin.html?highlight=user#login-user-interface-and-identity-management-system
官方例子用的ASP.NET Core Identity参考:
https://identityserver4.readthedocs.io/en/latest/quickstarts/6_aspnet_identity.html#refaspnetidentityquickstart
Microsoft.AspNet.Identity 自定义使用现有的表—登录实现, 一篇可能过时的文档可以参考一下.
https://www.cnblogs.com/calvinK/p/4648138.html
Finally, notice the addition of the new call to AddAspNetIdentity<ApplicationUser>. AddAspNetIdentity adds the integration layer to allow IdentityServer to access the user data for the ASP.NET Core Identity user database. This is needed when IdentityServer must add claims for the users into tokens.
Note that AddIdentity<ApplicationUser, IdentityRole> must be invoked before AddIdentityServer.
参考一下AddAspNetIdentity里面的实现, 看看替换了哪些service, 照葫芦画瓢你可以替换就为你自己的任何实现就可以了.