【发布时间】:2018-09-08 04:30:07
【问题描述】:
我目前正在开展一个项目,我正在尝试设置基于 IdentityServer4 (https://github.com/IdentityServer/IdentityServer4) 的服务,该服务通过 LDAP 查询本地 Active Directory 来验证用户身份。
为了实现这一点,我还在我的项目中包含了 IdentityServer4.LdapExtension (https://github.com/Nordes/IdentityServer4.LdapExtension)。存储库中的工作示例运行良好 (https://github.com/Nordes/IdentityServer4.LdapExtension/tree/master/Sample/IdentityServer) - 但自定义逻辑是 UI 的一部分,我需要我的服务在没有任何 UI 的情况下运行。
只需添加
.AddLdapUsers<ActiveDirectoryAppUser>(Conf.GetSection("ldap"), UserStore.InMemory)
如文档中所述,不会更改请求管道,因为提供的登录/验证方法永远不会执行 - 它们仅由来自 UI (AccountController) 的调用触发。但是,正如我所说,我不想在此服务中集成任何 UI,而是使用 Token-Endpoint 已经提供的接口(带有 client_id 和 client_secret 的 POST 请求,带有 JWT 的响应)。
有没有一种方法可以集成 LDAP 身份验证,而无需根据需要重写开箱即用的大部分内容?
【问题讨论】:
标签: asp.net-core ldap identityserver4