Jizhousoft.APB.Ldap
1.0.0
dotnet add package Jizhousoft.APB.Ldap --version 1.0.0
NuGet\Install-Package Jizhousoft.APB.Ldap -Version 1.0.0
<PackageReference Include="Jizhousoft.APB.Ldap" Version="1.0.0" />
paket add Jizhousoft.APB.Ldap --version 1.0.0
#r "nuget: Jizhousoft.APB.Ldap, 1.0.0"
// Install Jizhousoft.APB.Ldap as a Cake Addin #addin nuget:?package=Jizhousoft.APB.Ldap&version=1.0.0 // Install Jizhousoft.APB.Ldap as a Cake Tool #tool nuget:?package=Jizhousoft.APB.Ldap&version=1.0.0
Convert from APB.Ldap
Refrence:
https://aspnetboilerplate.com/Pages/Documents/Zero/User-Management#ldapactive-directory
LDAP/Active Directory LdapAuthenticationSource is an implementation of external authentication to make users login with their LDAP (active directory) user name and password.
If we want to use LDAP authentication, we must first add the Abp.Zero.Ldap NuGet package to our project (generally to the Core (domain) project). We then must extend the LdapAuthenticationSource for our application as shown below:
Copy public class MyLdapAuthenticationSource : LdapAuthenticationSource<Tenant, User> { public MyLdapAuthenticationSource(ILdapSettings settings, IAbpZeroLdapModuleConfig ldapModuleConfig) : base(settings, ldapModuleConfig) { } } Lastly, we must set a module dependency to AbpZeroLdapModule and enable LDAP with the auth source created above:
Copy
[DependsOn(typeof(AbpZeroLdapModule))]
public class MyApplicationCoreModule : AbpModule
{
public override void PreInitialize()
{
Configuration.Modules.ZeroLdap().Enable(typeof (MyLdapAuthenticationSource));
}
...
} After these steps, the LDAP module will be enabled for your application, but LDAP auth is not enabled by default. We can enable it using the settings.
Settings The LdapSettingNames class defines constants for setting names. You can use these constant names while changing settings (or getting settings). LDAP settings are per-tenant (for multi-tenant applications), so different tenants have different settings (see the setting definitions on github).
As you can see in the MyLdapAuthenticationSource constructor, LdapAuthenticationSource expects ILdapSettings as a constructor argument. This interface is used to get the LDAP settings like domain, user name and password to connect to Active Directory. The default implementation (LdapSettings class) gets these settings from the setting manager.
If you work with Setting manager, then there's no problem. You can change the LDAP settings using the setting manager API. If you want, you can add some initial seed data to the database to enable LDAP auth by default.
Note: If you don't define a domain, username and password, LDAP authentication works for the current domain if your application runs in a domain with appropriate privileges.
Custom Settings If you want to define another setting source, you can implement a custom ILdapSettings class as shown below:
Copy public class MyLdapSettings : ILdapSettings { public async Task<bool> GetIsEnabled(int? tenantId) { return true; }
public async Task<ContextType> GetContextType(int? tenantId)
{
return ContextType.Domain;
}
public async Task<string> GetContainer(int? tenantId)
{
return null;
}
public async Task<string> GetDomain(int? tenantId)
{
return null;
}
public async Task<string> GetUserName(int? tenantId)
{
return null;
}
public async Task<string> GetPassword(int? tenantId)
{
return null;
}
} Then register it to IOC in PreInitialize method of your module:
Copy [DependsOn(typeof(AbpZeroLdapModule))] public class MyApplicationCoreModule : AbpModule { public override void PreInitialize() { IocManager.Register<ILdapSettings, MyLdapSettings>(); //change default setting source Configuration.Modules.ZeroLdap().Enable(typeof (MyLdapAuthenticationSource)); }
...
} Then you can get the LDAP settings from another source.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 is compatible. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
-
.NETCoreApp 2.0
- Abp.ZeroCore (>= 3.4.0)
- System.DirectoryServices.AccountManagement (>= 4.5.0-preview1-26216-02)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 1,168 | 3/8/2018 |