Dear community users, this page is aimed at describing how to implement LDAP authentication for the CIFS subsystem in Alfresco Community 3.4b.
This work has been heavily based on the contribution of Mr. Vycital LDAP-CIFS on Alfresco Enterprise v3.0.0 about the same subject, that I STRONGLY suggest you to read, as I will not repeat the same concepts.
My only addition is about making it work under Alfresco 3.4b, which proved to be tough at the beginning.
After some run in debug mode and deep inspection of the Alfresco code, I basically found that there was a missing reference to the RepositoryAuthenticationDao in the scope of alfresco-authentication-context (for NTLM).
So, the RepositoryAuthenticationDao is the same as Mr. Vycital posted, while I changed the implementation of the LDAPAuthenticationComponentImpl bean into the following (changing also the name to CIFSLDAPAuthenticationComponentImpl to better see its use through the logs):
This file should be compiled as usual and put into <ALF_HOME>/tomcat/shared/classes/com/company/repo/security/authentication/ldap/LDAPAuthenticationComponentImpl.class, together with the new RepositoryAuthenticationDao that you already found in Vycital page.
Once the code is there, you have to reference it in several places:
tomcat/webapps/alfresco/WEB-INF/classes/alfresco/authentication-services-context.xml, where you need to just put the bean definition (it will be autowired by interface). Basically add this snippet where you want:
tomcat/webapps/alfresco/WEB-INF/classes/alfresco/subsystems/Authentication/common-ldap-context.xml, where you should insert the bean definition for the new CIFSLDAPAuthenticationComponentImpl and the new dao itself:
The authentication component above is just like the original you already found in the file, but the name is changed (we use a different class) and the authentication DAO is explicitly wired through the property definition.
tomcat/webapps/alfresco/WEB-INF/classes/alfresco/subsystems/Authentication/alfrescoNtlm/alfresco-authentication-context.xml, this the last file to change and it's the most important one. Here you change the DAO used to look for the user (and their credentials) in the store while doing the CIFS authentication. Basically you define another instance of the RepositoryAuthenticationDao and wire it to appropriate component:
In this file you just need to add the bean definition for the custom RepositoryAuthenticationDao but don't forget to change the reference in the authenticationComponent bean definition, by changing the property authenticationDao value to authenticationDaoFull in order to reference our custom DAO.
At this point, you should configure your LDAP and CIFS server according to your needs and the CIFS authentication will be made against the LDAP password.
Just keep in mind that, for the CIFS authentication subsystem in order to find the appropriate password, the user must have logged in into the system at least once and if they change the LDAP password, they must update their repository copy by logging in again into Alfresco.
Should you have any question about it, discuss this topic and I'll try to help you.