Saturday, May 12, 2012

Fixing Alfresco's external user issue (external user cannot authenticate because he is created as disabled)

Hi, all:

Recently I installed Alfresco for one of our customers. We set it up to used LDAP authentication and Synchronization against Zimbra's LDAP an it all worked just fine. The authentication chain was, therefore, first LDAP, second AlfrescoNTLM (the default internal authentication).

However, when testing the service with our client, we encoutered an issue: external users that were invited to a site received the email, but could not login to Alfresco Share. After googling around for a while, I found that it is a know issue in version 4.0.d (probably previous as well). See, for example, ALF-12242 and ALF-13289.

While a fix has existed for a while in Alfresco Enterprise, there was no solution for Community Edition. One of the above links actually says what the solution is (changing a few lines in a java class called InviteHelper and recompiling it), so we  downloaded the source code, fixed it, recompiled and packaged it back again on its corresponding JAR file. If you want it, you can take it from here. Note that you need to place this file under tomcat/webapps/alfresco/WEB-INF/lib/alfresco-repository-4.0.d.jar (yes, you must overwrite the previous one).

I hope it is useful for you!


7 comments:

Brian Weinberg said...

I appreciate the effort, but am curious of a few things before I attempt your fix.

How successful has this fix been for you? Have you tried it on different installations? Have you had any feedback from Alfresco on it?

Unknown said...

This worked perfectly. Thanks! I had the code checked out but was too tired/lazy to make the fix and recompile it.

Brian Weinberg said...

The Alfresco Forum topic that referenced this blog (https://forums.alfresco.com/en/viewtopic.php?f=47&t=44602 ) instructs as follows:

Stop alfresco.
Copy the JAR file under tomcat/webapps/alfresco/WEB-INF/lib
Remove Copy the jar file under tomcat/webapps/alfresco.war, to prevent tomcat from overwriting our JAR with the stock one.
Start alfresco

How do you Remove Copy the jar file under tomcat/webapps/alfresco.war? Does that need to be decompiled first?

Brian Weinberg said...

The only thing I see under tomcat/webapps/alfresco.war is yui. I don't see alfresco-repository-4.0.d.jar in the alfresco.war file

Brian Weinberg said...

I did all, while skipping the third step, and it seems to work fine.

Brian Weinberg said...

It only appears to have worked for a while, as the original behavior is now occurring again. Perhaps it is the step that I skipped (see above), but I am not clear on what he is instructing without a little more clarification. If somebody could shed some light on the specifics of the 3rd step (i.e. copy the file into the .war file, into the same directory, etc.), I would gladly test and share any results.

Unknown said...

Thank you!
The fix also works with alfresco community 4.0.c.

Just extract InvitationHelper classes from the attached alfresco-repository-4.0.d.jar and replace InvitationHelper*.class files in alfresco-repository-4.0.c.jar

This works because InvitationHelper is the same in 4.0.c and 4.0.d.

https://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/COMMUNITYTAGS/V4.0c/root/projects/repository/source/java/org/alfresco/repo/invitation/InviteHelper.java

https://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/COMMUNITYTAGS/V4.0d/root/projects/repository/source/java/org/alfresco/repo/invitation/InviteHelper.java

I hope this help!

Piero