问题描述
我想使用免费启动模板版本的 Boilerplate 在我的 .net Core 应用程序中通过 Active Directory 集成身份验证.我按照 documentation 中的说明进行操作,例如安装 Abp.Zero.Ldap 包,创建 LdapAuthenticationSource 类,注入依赖,如:
I would like to integrate authentication via Active Directory in my .net Core app using Free Startup Template version of the Boilerplate. I followed the instruction in the documentation such as installing Abp.Zero.Ldap package, creating LdapAuthenticationSource class, and injecting dependency like:
[DependsOn(typeof(AbpZeroLdapModule))]
public class MyApplicationCoreModule : AbpModule
{
public override void PreInitialize()
{
Configuration.Modules.ZeroLdap().Enable(typeof (MyLdapAuthenticationSource));
}
...
}
我是否需要使用实现 ILdapSettings 接口的类来定义任何自定义设置?或创建任何引用 的类或文件这个文件夹?
Do I need to define any custom settings by using a class implementing ILdapSettings interface? Or create any class or files referencing to this folder?
推荐答案
.NET Core 2.0
这些说明可能不起作用,因为 .NET Core 的 LDAP/AD 身份验证扩展尚未实现.
.NET Core 2.0
The instructions may not work, as LDAP / AD auth extension for .NET Core isn't implemented yet.
跟踪此功能:https://github.com/aspnetboilerplate/aspnetboilerplate/issues/2755
通过安装 Abp.Zero.Ldap 包,您已经在引用该模块(移动 这里).
By installing Abp.Zero.Ldap package, you're already referencing that module (moved here).
如 LDAP/Active Directory > 设置中所述:
LdapAuthenticationSource 期望 ILdapSettings 作为构造函数参数.此接口用于获取域、用户名和密码等 LDAP 设置以连接到 Active Directory.默认实现(LdapSettings 类)从设置管理器获取这些设置.
LdapAuthenticationSource expects ILdapSettings as a constructor argument. This interface is used to get LDAP settings like domain, user name and password to connect to Active Directory. Default implementation (LdapSettings class) gets these settings from the setting manager.
如果您使用设置管理器,那么没问题.您可以使用 设置管理器 API 更改 LDAP 设置.如果需要,您可以将初始/种子数据添加到数据库以默认启用 LDAP 身份验证.
If you work with Setting manager, then no problem. You can change LDAP settings using setting manager API. If you want, you can add an initial/seed data to database to enable LDAP auth by default.
因此,您无需创建实现 ILdapSettings 的类.使用设置管理器的好处是它将设置存储在您的数据库中.自定义类用于从其他地方获取它或对其进行硬编码(如果您只是想尝试,这很有用,但在生产/git commit 中是一个很大的禁忌).
So, you don't need to create a class that implements ILdapSettings. The benefit of using the Setting Manager is that it stores the settings in your database. A custom class is for getting it from elsewhere or hardcoding it (useful if you just want to try, but a big no-no in production / git commit).
首先,您可以在 DefaultSettingsCreator 与 LdapSettingNames:
For a start, you can add seed data for your Host in DefaultSettingsCreator with LdapSettingNames:
public void Create()
{
// ...
// LDAP
AddSettingIfNotExists(LdapSettingNames.IsEnabled, "false");
// AddSettingIfNotExists(LdapSettingNames...
}
这篇关于如何在 ASP.NET 样板中使用 LDAP(免费启动模板)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)