Open Closed

LDAP Issue #5941


User avatar
0
s.alshammari.c created

hi,

I tried to integrate my organization with abp using Ldap on MVC and it worked fine with me. now I am using backend with angular template and I get the following error

An unhandled exception occurred while processing the request. LdapOperationsErrorException: Operations Error. Operations Error. Result: 1. Method: ldap_parse_result. Details: ErrorMessage: 000004DC: LdapErr: DSID-0C090ACD, comment: In order to perform this operation a successful bind must be completed on the connection., data 0, v4563 LdapForNet.Native.LdapNative.ThrowIfError(SafeHandle ld, int res, string method, IDictionary<string, string> details)


3 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Could you share the full steps to reproduce? thanks.

  • User Avatar
    0
    s.alshammari.c created

    all classes are on FinalizedApp.HttpApi.Host

    ------------------------------------------
    using Microsoft.AspNetCore.Identity;
    using Microsoft.Extensions.Options;
    using System.Threading.Tasks;
    using Volo.Abp.Features;
    using Volo.Abp.Guids;
    using Volo.Abp.Identity.ExternalLoginProviders.Ldap;
    using Volo.Abp.Identity;
    using Volo.Abp.Ldap;
    using Volo.Abp.MultiTenancy;
    using Volo.Abp.Settings;
    
    namespace FinalizedApp
    {
        public class VoloLdapExternalLoginProvider : LdapExternalLoginProvider
        {
            public VoloLdapExternalLoginProvider(
                IGuidGenerator guidGenerator,
                ICurrentTenant currentTenant,
                IdentityUserManager userManager,
                IIdentityUserRepository identityUserRepository,
                OpenLdapManager ldapManager,
                ILdapSettingProvider ldapSettingProvider,
                IFeatureChecker featureChecker,
                ISettingProvider settingProvider,
                IOptions<IdentityOptions> identityOptions)
                : base(guidGenerator,
                    currentTenant,
                    userManager,
                    identityUserRepository,
                    ldapManager,
                    ldapSettingProvider,
                    featureChecker,
                    settingProvider,
                    identityOptions)
            {
    
    
    
            }
    
            protected override async Task<string> NormalizeUserNameAsync(string userName)
            {
                // Default is $"uid={userName}, {BaseDc}"
                // or "userName@domain 
                //await LdapSettingProvider.GetDomainAsync();
                var loginUserName = await Task.FromResult($"{userName}");
                return loginUserName;
            }
    
    
    
    
        }
    }
    
    --------------------------------------
    
    using LdapForNet;
    using System.Threading.Tasks;
    using Volo.Abp.DependencyInjection;
    using Volo.Abp.Identity.ExternalLoginProviders.Ldap;
    using Volo.Abp.Ldap;
    
    namespace FinalizedApp
    {
        [Dependency(ReplaceServices = true)]
        [ExposeServices(typeof(OpenLdapManager), typeof(ILdapManager), typeof(LdapManager))]
        public class VoloOpenLdapManager : OpenLdapManager
        {
            public VoloOpenLdapManager(ILdapSettingProvider ldapSettingProvider)
                : base(ldapSettingProvider)
            {
    
            }
    
            protected override async Task<string> NormalizeUserNameAsync(string userName)
            {
                // or "userName@domain 
                //await LdapSettingProvider.GetDomainAsync();
                return await Task.FromResult($"{userName}");
            }
    
            protected override Task<string> GetUserFilterAsync(string userName)
            {
                // Default is $"cn={userName},{LdapOptions.BaseDc}"
                return Task.FromResult($"(&(objectClass=user)(sAMAccountName={userName}))");
    
            }
    
            protected override Task<string> GetUserEmailAsync(LdapEntry ldapEntry)
            {
                return Task.FromResult(ldapEntry.ToDirectoryEntry().GetAttribute("mail")?.GetValue<string>());
    
            }
        }
    }
    
    
    --------------------------------------------------
        Configure<AbpIdentityOptions>(options =>
        {
            options.ExternalLoginProviders.Remove(LdapExternalLoginProvider.Name);
            options.ExternalLoginProviders.Add<VoloLdapExternalLoginProvider>(LdapExternalLoginProvider.Name);
        });
    }
    
    ---------------------------------
    
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    It looks like not related to angular UI but your LDAP server.

    In order to perform this operation a successful bind must be completed on the connection

    Here are some links may be helpful:

    https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0754219 https://stackoverflow.com/questions/60345525/to-perform-this-operation-a-successful-bind-must-be-completed-on-the-connection

    If you can provide the full steps or a project to reproduce the problem. I will check it. shiwei.liang@volosoft.com

Made with ❤️ on ABP v9.1.0-preview. Updated on December 05, 2024, 12:19