Base solution for your next web application
Open Closed

ABP/Modue Zero and Active Directory #311


User avatar
0
zokho created

Hi, Has any progress been made to integrate Active Directory with the ABP? If yes, could you please guide me to a documentation or sample that might describe it?

Thanks,


6 Answer(s)
  • User Avatar
    0
    iyhammad created

    Hi,

    LDAP Authentication is working perfectly. you can start here <a class="postlink" href="http://www.aspnetboilerplate.com/Pages/Documents/Zero/User-Management#ldapactive-directory">http://www.aspnetboilerplate.com/Pages/ ... -directory</a>

    Thanks,

  • User Avatar
    0
    tonywr created

    Hi there,

    I am also trying to implement Ldap Authentication.

    I have set up the AbpCompanyName project so that I can implement the proof of concept.

    As per the instructions, I have installed the Abp.Zero.Ldap package into the AbpCompanyName.AbpProjectName.Core package.

    The Abp.Zero.Ldap assembly is referenced in the Core project.

    At the root level of this folder I have added MyLdapAuthenticationSource.cs, as per the instructions.

    The final step was to enable MyLdapAuthenticationSource.

    I have added Configuration.Modules.ZeroLdap().Enable(typeof(MyLdapAuthenticationSource)); into the PreInitialize() method inside AbpProjectNameCoreModule.

    But it doesn't work.

    It cannot find ZeroLdap() in Configuration.Modules.

    How do I get it to recognise the ZeroLdap() method?

    Kind Regards, Tony

  • User Avatar
    0
    tonywr created

    Never mind, I found the issue. I had to include another couple of using statements and add a DependsOn statement to the class. It now looks like this, which compiles:

    using System.Reflection; using Abp.Modules; using Abp.Zero; using Abp.Zero.Ldap; using Abp.Configuration.Startup; using Abp.Zero.Ldap.Configuration;

    namespace AbpCompanyName.AbpProjectName { [DependsOn(typeof(AbpZeroCoreModule))] public class AbpProjectNameCoreModule : AbpModule { public override void PreInitialize() { Configuration.Modules.ZeroLdap().Enable(typeof(MyLdapAuthenticationSource)); }

        public override void Initialize()
        {
            IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
        }
    }
    

    }

  • User Avatar
    0
    tonywr created

    Ok, still on the topic, which is getting Active Directory working with Abp.

    As I've said before, I am currently modifying the AbpCompanyName.AbpProjectName sample application to get it authenticating properly with Ldap.

    The application compiles properly, and runs, but it still redirects to the Account Login page.

    I have found the code where it redirect to the Account Login page, which is in App_Start\Startup.cs

    public void Configuration(IAppBuilder app)
    {
                // Enable the application to use a cookie to store information for the signed in user
                app.UseCookieAuthentication(new CookieAuthenticationOptions
                {
                    AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                    LoginPath = new PathString("/Account/Login")
                });
    
                // Use a cookie to temporarily store information about a user logging in with a third party login provider
                app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
    }
    
    1. How do I change this to get it to recognise the logged on Active Directory account?
    2. I have added the following line to system.web, which I think makes sense in IIS. Is this the correct way to go about this?
    <system.web>
    ...
        <authentication mode="Windows"/>
    </system.web>
    
    1. How do I determine who the currently logged in user is?

    Thanks again, Tony

  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    How do I get it to recognise the ZeroLdap() method?

    It's an extension method. Normally, your IDE could find it. You can add this namespace:

    using Abp.Zero.Ldap.Configuration;
    

    Then it should work.

  • User Avatar
    0
    tonywr created

    I have now downloaded the Simple Task System and installed the Abp.Zero.Ldap package.

    I have implemented the User.cs and Tenant.cs classes in SimpleTaskSystem.Core.

    I have added MyLdapAuthenticationSource.cs in SimpleTaskSystem.Core.

    I have added

    public override void PreInitialize()
    {
        Configuration.Modules.ZeroLdap().Enable(typeof(MyLdapAuthenticationSource));
    }
    

    in to the SimpleTaskSystemCoreModule

    The system compiles successfully.

    I then run the SimpleTaskSystem.WebSpaAngular project and it fails to execute angular code.

    It displays all the angular tags in the page, such as Task List - {{vm.getTaskCountText()}} and {{vm.currentLanguage.displayName}}

    I have put an image of what I am seeing here: [http://1drv.ms/1JLNfQj])

    I have put a copy of the SimpleTaskSystem with my Ldap changes here: [https://github.com/tonywr71/SimpleTaskSystemWithLdap])

    If anyone can help me, that would be much appreciated.