如何在ASP.NET Boilerplate中使用LDAP(免费启动模板) [英] How to use LDAP in ASP.NET Boilerplate (Free Startup Template)

查看:108
本文介绍了如何在ASP.NET Boilerplate中使用LDAP(免费启动模板)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Boilerplate的免费启动模板版本通过Active Directory将身份验证集成到.net Core应用程序中.我按照文档中的说明进行操作,例如安装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).

首先,您可以在

这篇关于如何在ASP.NET Boilerplate中使用LDAP(免费启动模板)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆