1. 程式人生 > >ABP LDAP 採用域使用者登入

ABP LDAP 採用域使用者登入

  1. 通過NuGet在Core專案增加Abp.Zero.Ldap的引用
  2. 在Core專案中增加MyExternalAuthSource.cs, MyLdapAuthenticationSource.cs, MyLdapSettings.cs

    詳細內容可找作者聯絡。

  3. 修改XXXCoreModule.cs
    開始處增加typeof, 並在PreInitialize()增加註入之模組,程式碼如下:
    [DependsOn(typeof(AbpZeroCoreModule),typeof(AbpZeroLdapModule))]
    public class DevTaskCoreModule : AbpModule
        {
            public override void PreInitialize()
            {
                //Inject LDAP for authentication
                IocManager.Register<ILdapSettings, MyLdapSettings>(); //change default setting source
                Configuration.Modules.ZeroLdap().Enable(typeof(MyLdapAuthenticationSource));
                Configuration.Modules.Zero().UserManagement.ExternalAuthenticationSources.Add<MyExternalAuthSource>();
               ......

  4. 在Web專案的Web.config的appSetting節點中增加
    <add key="LdapPath" value="LDAP://XX.XXX.COM" />