Activities of "liangshiwei"

Hi,

Please share the full steps include the LDAP server Information(users etc..)

Hi,

How I reproduce the problem. could you share the full steps to reproduce? I will check it. thanks.

Hi,

Because it didn't find a user!

The search code logic is the same as the AbpLdapSample example:

https://github.com/abpframework/abp-samples/blob/master/AbpLdapSample/AbpLdapSample/Program.cs#L38

You can test your LDAP configuration through AbpLdapSample.

If it still doesn't work, can you share the LDAP configuration and test users with me? shiwei.liang@volosoft.com I'll check it.

I think it returns a null value.

This is the source code:

protected async override Task<ExternalLoginUserInfo> GetUserInfoAsync(string userName)
{
    var email = await LdapManager.GetUserEmailAsync(userName);
    if (email.IsNullOrWhiteSpace())
    {
        throw new Exception("Unable to get the email of ldap user!");
    }
    return new ExternalLoginUserInfo(email);
}

-------------

[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(OpenLdapManager), typeof(ILdapManager), typeof(LdapManager))]
public class OpenLdapManager : LdapManager
{
    public OpenLdapManager(ILdapSettingProvider ldapSettingProvider)
        : base(ldapSettingProvider)
    {

    }

    public virtual async Task<string> GetUserEmailAsync(string userName)
    {
        using (var conn = await CreateLdapConnectionAsync())
        {
            await AuthenticateLdapConnectionAsync(conn, await NormalizeUserNameAsync(await LdapSettingProvider.GetUserNameAsync()), await LdapSettingProvider.GetPasswordAsync());

            var searchResults = await conn.SearchAsync(await GetBaseDnAsync(), await GetUserFilterAsync(userName));
            try
            {
                var userEntry = searchResults.First();
                return await GetUserEmailAsync(userEntry);
            }
            catch (LdapException e)
            {
                Logger.LogException(e);
            }

            return null;
        }
    }

    protected async override Task ConnectAsync(ILdapConnection ldapConnection)
    {
        ldapConnection.Connect(await LdapSettingProvider.GetServerHostAsync(), await LdapSettingProvider.GetServerPortAsync());
    }

    protected virtual async Task<string> NormalizeUserNameAsync(string userName)
    {
        return $"cn={userName},{await LdapSettingProvider.GetBaseDcAsync()}";
    }

    protected virtual Task<string> GetUserEmailAsync(LdapEntry ldapEntry)
    {
        return Task.FromResult(ldapEntry.ToDirectoryEntry().GetAttribute("mail")?.GetValue<string>());
    }

    protected virtual async Task<string> GetBaseDnAsync()
    {
        return await LdapSettingProvider.GetBaseDcAsync();
    }

    protected virtual Task<string> GetUserFilterAsync(string userName)
    {
        return Task.FromResult($"(&(uid={userName}))");
    }
}

You need to add the mail attribute to the LDAP user.

Or you can override the GetUserEmailAsync method

Also, could you also explain to me what was happening in the default components I need to override? In case another problem of the sort happens.

Because the component is rendered in real-time, it did not bind the initialization event. call events after rendering components through this temporary solution.

We will fix it in the next patch version, you can safely delete them in a later version(Leptonx Theme package)

Hi,

Oh I didnt see your message that says that its Blazor's design. Do you have any documentation I could read that explains it?

The Microsoft document does not explain in detail, it just briefly mentions it.

AuthenticationService handles the low-level details of the OIDC protocol. The app internally calls methods defined in the script to perform the authentication operations.

https://learn.microsoft.com/en-us/aspnet/core/blazor/security/webassembly/standalone-with-authentication-library?view=aspnetcore-7.0&tabs=visual-studio#index-page

Check the source code and you will find that it will try to process the callback every time the application starts. https://github.com/dotnet/aspnetcore/blob/release/7.0/src/Components/WebAssembly/WebAssembly.Authentication/src/Interop/AuthenticationService.ts#L520

Hi,

You can check the document: https://docs.abp.io/en/commercial/latest/modules/identity/ldap#customize-built-in-services

Hi,

It works for me:

LDAP server:

docker run --name ldap -d --env LDAP_ORGANISATION="abp" --env LDAP_DOMAIN="abp.com" --env LDAP_ADMIN_PASSWORD="123456" -p 389:389 -p 636:639 --detach osixia/openldap

LDAP user:

I will check it

Showing 3341 to 3350 of 6693 entries
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.1.0-preview. Updated on December 17, 2025, 07:08
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.