Issue Details (XML | Word | Printable)

Key: XWIKI-1079
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Thomas Mortagne
Reporter: Gunter Leeb
Votes: 5
Watchers: 7
Operations

If you were logged in you would be able to see more operations.
XWiki Core

LDAP Authentication

Created: 12/Apr/07 16:01   Updated: 19/Feb/08 11:11
Component/s: Admin, Authentication and Rights Management, Plugin - Other, Wiki features
Affects Version/s: 1.0 B6
Fix Version/s: 1.3 M2

File Attachments: 1. Text File 20080207-new_ldap_auth.patch (51 kB)
2. Text File 20080208-new_ldap_auth.patch (54 kB)
3. Text File 20080211-new_ldap_auth.patch (83 kB)
4. Zip Archive 20080212-new_ldap_auth.zip (1.37 MB)
5. Zip Archive ldap.zip (27 kB)
6. File LDAPAuthenticater.class (23 kB)
7. Java Source File LDAPAuthenticater.java (47 kB)
8. Java Source File LDAPAuthenticater.java (47 kB)
9. Java Source File LDAPAuthenticater.java (38 kB)
10. Text File new_ldap_auth.patch (47 kB)
11. Zip Archive ssl.zip (27 kB)
12. Zip Archive XWiki.zip (56 kB)

Issue Links:
Duplicate
 
Related

keywords: LDAP patch
Date of First Response: 04/May/07 08:16
Resolution Date: 18/Feb/08 13:15
Tests: Unit, Integration


 Description  « Hide
Implementation of a substitude LDAP authentication class.

The new features and changes:

  • Separate LDAP login and authentication validation
  • An LDAP group membership is first checked before a user can be authenticated against LDAP
  • LDAP Groups are handled recursivly (groups in groups)
  • LDAP Groups and their members are cached with an expiration
  • LDAP attributes can update XWiki user attributes configurable at create time or on every login
  • LDAP group membership can be sync'ed with XWiki group membership
  • If authentication with LDAP fails it still will try to authenticate against the XWiki DB
  • detailed comments in xwiki.cfg
  • pretty much every detail of the behavior can be configured in xwiki.cfg
  • All valuable features from the old LDAPAuthServiceImpl are reimplemented (except for LDAP bind being sufficent for login implemented by the check_level configuration)
  • Any LDAP attribute can be used containing the XWiki name
  • Added SSL support
  • Each virtual server can have it's own LDAP configuration even enable disable LDAP

This has been tested against OpenLDAP, Novell eDirectory and ApacheDS.

I would like to ask for a code-read, verification of how the module is using the XWiki APIs and testing in various environments.
Most of all, I am looking for feedback.



 All   Comments   Change History   FishEye      Sort Order: Ascending order - Click to sort in descending order
Gunter Leeb added a comment - 12/Apr/07 16:04
Contains the sources as well as the compiled jars to be tested easily by placing the entire classes directory into the WEB_INF. There is also a extensivly documented xwiki.cfg with example settings for the LDAP Authenticator.

Gunter Leeb added a comment - 20/Apr/07 14:43
I have now added support for SSL.
Now there are 2 additional parameters:
  1. 1 will turn on SSL
    xwiki.authentication.ldap.ssl=0
  1. keystore for certificates / root certificates (default is .keystore in the xwiki-process-users homedirectory)
    xwiki.authentication.ldap.ssl.keystore=<path_to_ssl_keystore>
  1. wenn nicht gesetzt wird der SSL Default port verwendet (je nachdem ob SSL oder nicht)
    xwiki.authentication.ldap.port=636

xwiki.authentication.ldap.groupcache_expiration


Ji?í Hanu? added a comment - 04/May/07 08:16
Hi,
I've tested it with 1.0 rc3 and fixed few things:
  • Assigning the user to mapped groups now works
  • In the case the Authenticator binds to LDAP with the user name/password, its not necessary to additionaly verify password. So there is additional property:

Ji?í Hanu? added a comment - 04/May/07 08:21
The property is:
  1. Optionally disable password check on userPassword LDAP attribute. Useful when bind_DN and bind_pass contains the user name and password.
    xwiki.authentication.ldap.validate_password=0

And now it works for Active Directory too. Anyway, good work, Gunter ! You added authorization synchronization to the LDAP login module, I mean it should be included in the main distribution.


Gunter Leeb added a comment - 29/May/07 20:47
In this upload, I merged some bug fixes, the ssl code and Jiri's changes together.

Gunter Leeb added a comment - 18/Jun/07 15:32
Found a bug, that a partial user name is accepted. This update fixes this issues as well as implements a cleaner handling if a LDAP Query returns more than one result.

simple user added a comment - 04/Jul/07 17:42
Hi,

Currently, I am testing to integrate xwiki (1.0 or 1.1 milestones 2) with the LDAP authentication (Lotus Domino). To do that, I add the files in the zip (from this site) with the last authenticater.java (compiled to have the authenticater.class).

But I have a problem, the "CN" field is componed like this : "firstname lastname" (with a space). To fix it, I created a variable "origin_user" that contains the good format used for queries with the LDAP server.

Now, the authentication LDAP seems to be good (the capture of the ldap request proves it) but I have this error in my xwiki.log (or my catalina.out) and I can't access to the xwiki (i always come back on the identification form) without being authentified :

================================================================================================================
16:13:06,563 ERROR http-8080-Processor25 http://10.2.1.3:8080/xwiki/bin/loginsubmit/XWiki/XWikiLogin LDAPAuthenticater:authenticate:446 - LDAP authentication failed.
com.xpn.xwiki.XWikiException: Error number 8002 in 8: Cannot create user XWiki.usertest
Wrapped Exception: null
at com.xpn.xwiki.XWiki.createUser(XWiki.java:2847)
at com.xpn.xwiki.ldap.authentication.LDAPAuthenticater.createUserFromLDAP(LDAPAuthenticater.java:758)
....

Wrapped Exception:

java.lang.NullPointerException
at com.xpn.xwiki.XWiki.createUser(XWiki.java:2839)
at com.xpn.xwiki.ldap.authentication.LDAPAuthenticater.createUserFromLDAP(LDAPAuthenticater.java:758)
at com.xpn.xwiki.ldap.authentication.LDAPAuthenticater.authenticate(LDAPAuthenticater.java:329)
================================================================================================================

Is it a bug ? Or is there something wrong in my conf :
================================================================================================================
[XWIKI.cfg]
xwiki.authentication.ldap=1
xwiki.authentication.authclass=com.xpn.xwiki.ldap.authentication.LDAPAuthenticater
xwiki.authentication.ldap.server=ldap_srv
xwiki.authentication.ldap.check_level=1
xwiki.authentication.ldap.port=389
xwiki.authentication.ldap.base_DN=o=testdomain
xwiki.authentication.ldap.bind_DN=cn=bind user,o=testdomain
xwiki.authentication.ldap.bind_pass=pwd
xwiki.authentication.ldap.UID_attr=cn
xwiki.authentication.ldap.fields_mapping=name=cn,last_name=sn,first_name=givenName,fullname=displayName,email=mail,ldap_dn=dn
xwiki.authentication.ldap.validate_password=1
xwiki.authentication.unauthorized_code=200
xwiki.authentication.ldap.user_group=cn=membres_in_group
================================================================================================================

I don't know what I can do now. It would be great if you could help me.

Thank you very much for having time on my problem.

PS : sorry for my english, it's a little normal I am french.


simple user added a comment - 05/Jul/07 11:35
Good morning,

I come back to give some information about the LDAPAuthenticater class.

To debug, i activated the debug mode (in the log4j.properties). Because of that, I could have more elements to understand why it didn't work.

In the class LDAPAuthenticater, i have called the function "runtimeTest" with the context of the authentication form and i have got this message in the log :

===============================================================================================================
01:55:13,330 DEBUG http-8080-Processor24 http://10.2.1.3:8080/xwiki/bin/loginsubmit/XWiki/XWikiLogin LDAPAuthenticater:runtimeTest:1185 - create user 1
01:55:13,361 DEBUG http-8080-Processor24 http://10.2.1.3:8080/xwiki/bin/loginsubmit/XWiki/XWikiLogin LDAPAuthenticater:runtimeTest:1203 - Testcode failed - ignore exception
com.xpn.xwiki.XWikiException: Error number 8002 in 8: Cannot create user XWiki.asdf
Wrapped Exception: null
at com.xpn.xwiki.XWiki.createUser(XWiki.java:2847)
at com.xpn.xwiki.ldap.authentication.LDAPAuthenticater.runtimeTest(LDAPAuthenticater.java:1186)
at com.xpn.xwiki.ldap.authentication.LDAPAuthenticater.authenticate(LDAPAuthenticater.java:104)
===============================================================================================================

I work on a xwiki-1.0 (I do my test in a xwiki-1.1-milestones2 too).

When I test to authenticate me (without the call of runtime), the error is the same as my first post (problem with the XWiki.CreateUser).

I am not a java killer so I don't know if I would manage to fix it. Perhapps, there is no bug and I don't use the class properly ?


Gunter Leeb added a comment - 05/Jul/07 13:11
Hi "simple user",

Great that you use my LDAPAuthenticater! First of all, I am not anywhere an expert in XWiki.

I'd like to give you some information on this strange runtimeTest method: At one time during my experiments with XWiki, I found that the XWiki original createuser method (pre- 1.0R) returned an exception, for me inexplicable. What I found, is that if I call this method in the beginning and let it fail with an exception there, later on, the second time, when the code really wants to create a user, it will work.

Some time later and with 1.0R, it worked for me, I just added a switch and left the code in. (I never figured out the real issue because of an old state of XWiki source code – and it finally worked )

What the "Testcode failed - ignore exception" means, is that a very simple createUser call to XWiki failed the first time. This exception can be ignored, expecting the call to createUser later on to succeed.

Does it create the XWiki user that you intend to create. The logs should be sufficently detailed if it fails somewhere in the LDAPAuthenticator. Best of my knowledge the LDAPAuthenticater calls XWiki.createUser with correct parameters (and that they should be correct is fairly obvious).

We would need someone of the XWiki gurus to have a look at this issue.

Gunter


Gunter Leeb added a comment - 05/Jul/07 13:16
One more thing, about your original issue. You may not need to use the cn attribute at all. If your Domino LDAP contains some other attribute which contains the user name as you want it, you can also have LDAPAuthenticater locate a user based on this attribute.

simple user added a comment - 05/Jul/07 17:46
Good afternoon,

Sorry, not to put my real name, firstname, I thought that my pseudo will be used to sign the posts.

You can call me "Simply" (pseudo) or Matthieu (my firstname).

I come back again to report a bug about the authentication with the attribute mail (yes I must use it, unfortunately).

This is the log that I have collected :
=================================================================================================================
17:44:07,683 DEBUG LDAPAuthenticater:authenticate:158 - Checking if the user belongs to the user group:
17:44:07,710 DEBUG LDAPAuthenticater:authenticate:191 - Found user dn with the user object: null
17:44:07,711 DEBUG LDAPAuthenticater:authenticate:201 - Ready to create user from LDAP with fields name=uid,last_name=sn,first_name=givenName,fullname=cn,email=mail,ldap_dn=cn
17:44:07,712 DEBUG LDAPAuthenticater:authenticate:215 - Found field mapping: name=uid
17:44:07,713 DEBUG LDAPAuthenticater:authenticate:215 - Found field mapping: last_name=sn
17:44:07,714 DEBUG LDAPAuthenticater:authenticate:215 - Found field mapping: first_name=givenName
17:44:07,715 DEBUG LDAPAuthenticater:authenticate:215 - Found field mapping: fullname=cn
17:44:07,716 DEBUG LDAPAuthenticater:authenticate:215 - Found field mapping: email=mail
17:44:07,716 DEBUG LDAPAuthenticater:authenticate:215 - Found field mapping: ldap_dn=cn
17:44:07,717 DEBUG LDAPAuthenticater:authenticate:227 - Searching for the user in LDAP: user:test@testdomain base:o=testdomain query:(mail=test@testdomain) uid:mail
17:44:07,720 DEBUG LDAPAuthenticater:searchLDAP:1030 - on fait la requete de recherche o=testdomain // log added by me
17:44:07,722 DEBUG LDAPAuthenticater:searchLDAP:1059 - LDAP Search failed
LDAPException: Insufficient Access Rights (50) Insufficient Access Rights
LDAPException: Matched DN:
at com.novell.ldap.LDAPResponse.getResultException(Unknown Source)
=================================================================================================================

As you can see it, my user has been truncated at the first '.', the orginal user was "simple.test@testdomain", this code is the guilty :

=================================================================================================================
// strip possible "XWiki."
// ATTENTION: Possible incompatibility to before now user is NEVER located with "XWiki.username" in LDAP
// Also Usernames must NOT have a . in the name
// as a consequence of LDAP, Usernames must NOT contain , as well
int i = user.indexOf(".");
if (i != -1) { user = user.substring(i + 1); }
=================================================================================================================

For the moment, it's not very important because the user creation doesn't work any more. For this problem, I put some new information (LOG):

=================================================================================================================
17:22:05,528 LDAPAuthenticater:authenticate:158 - Checking if the user belongs to the user group:
17:22:05,553 LDAPAuthenticater:authenticate:191 - Found user dn with the user object: null
17:22:05,556 LDAPAuthenticater:authenticate:201 - Ready to create user from LDAP with fields name=uid,last_name=sn,first_name=givenName,fullname=cn,email=mail,ldap_dn=cn
17:22:05,557 LDAPAuthenticater:authenticate:215 - Found field mapping: name=uid
17:22:05,558 LDAPAuthenticater:authenticate:215 - Found field mapping: last_name=sn
17:22:05,558 LDAPAuthenticater:authenticate:215 - Found field mapping: first_name=givenName
17:22:05,559 LDAPAuthenticater:authenticate:215 - Found field mapping: fullname=cn
17:22:05,560 LDAPAuthenticater:authenticate:215 - Found field mapping: email=mail
17:22:05,560 LDAPAuthenticater:authenticate:215 - Found field mapping: ldap_dn=cn
17:22:05,561 LDAPAuthenticater:authenticate:227 - Searching for the user in LDAP: user:stest base:o=testdomain query:(uid=stest) uid:uid
17:22:05,606 LDAPAuthenticater:searchLDAP:1030 - on fait la requete de recherche o=testdomain
17:22:05,617 LDAPAuthenticater:searchLDAP:1053 - attribute :sn = Test
17:22:05,624 LDAPAuthenticater:searchLDAP:1053 - attribute :mail = simple.test@testdomain.com
17:22:05,626 LDAPAuthenticater:searchLDAP:1053 - attribute :cn = simple test
17:22:05,626 LDAPAuthenticater:searchLDAP:1053 - attribute :givenname = Simple
17:22:05,627 LDAPAuthenticater:searchLDAP:1053 - attribute :uid = stest
17:22:05,629 LDAPAuthenticater:authenticate:282 - Found Attributes in LDAP 6
17:22:05,629 LDAPAuthenticater:authenticate:283 - Found user dn=CN=simple test,O=testdomain
17:22:05,630 LDAPAuthenticater:verifyPWD:990 - mot de passe:test login : CN=simple test,O=testdomain
17:22:05,638 LDAPAuthenticater:authenticate:307 - LDAP attributes will be used to update XWiki attributes.
17:22:05,639 LDAPAuthenticater:authenticate:331 - Creating new XWiki user based on LDAP attribues located at CN=simple test,O=testdomain
17:22:05,641 LDAPAuthenticater:createUserFromLDAP:755 - Mapping last_name to Test
17:22:05,646 LDAPAuthenticater:createUserFromLDAP:755 - Mapping email to simple.test@testdomain.com
17:22:05,646 LDAPAuthenticater:createUserFromLDAP:755 - Mapping ldap_dn to simple test
17:22:05,647 LDAPAuthenticater:createUserFromLDAP:755 - Mapping name to stest
17:22:05,647 LDAPAuthenticater:createUserFromLDAP:760 - Creating User: stest
17:22:05,654 ERROR http-8080-Processor24 http://10.2.1.3:8080/xwiki/bin/loginsubmit/XWiki/XWikiLogin LDAPAuthenticater:authenticate:449 - LDAP authentication failed.
com.xpn.xwiki.XWikiException: Error number 8002 in 8: Cannot create user XWiki.stest
Wrapped Exception: null
.....
=================================================================================================================

For thes results, I use the xwiki.cfg, here :

=================================================================================================================
xwiki.authentication.ldap=1
xwiki.authentication.authclass=com.xpn.xwiki.ldap.authentication.LDAPAuthenticater
xwiki.authentication.ldap.server=test.testdomain
xwiki.authentication.ldap.check_level=1
xwiki.authentication.ldap.port=389
xwiki.authentication.ldap.base_DN=o=testdomain
xwiki.authentication.ldap.bind_DN=cn=bind user,o=testdomain
xwiki.authentication.ldap.bind_pass=pwd
xwiki.authentication.ldap.UID_attr=mail // for the problem with the mail and uid for the problem with the creation ot the user
xwiki.authentication.ldap.fields_mapping=name=uid,last_name=sn,first_name=givenName,fullname=cn,email=mail,ldap_dn=cn
xwiki.authentication.ldap.validate_password=1
xwiki.authentication.unauthorized_code=200
=================================================================================================================

I give you all this, one for the bug with the mail and for another reason, if you can see a problem in the log display or in my configuration, it will be fantastic because it'is not normal if for you it works and not for me.

Thanks.

PS : bouarf, it's very difficult to speak / write in English.


simple user added a comment - 09/Jul/07 18:41
Yo,

To conclude my experience, I have recoded the class Authenticate (in fact, I have adapted what you do in my case).

There is some problem in the original code (your class) for example :

  • for me the function createUserFromLDAP modified doesn't work but the original function (which was commented) work very well (except for the mapping like first_name, last_name but it's not very important
  • there is a problem with the variable user_dn, it's weird used (I lost my way with this) and for example when a user is already present in the xwiki base but without ldap_dn, the user_dn = "" (nothing),
  • the function findInGroup isn't universal, for example : my "cn" are componed like this "name last_name" but if I use the login typed by the user it will be a value without space then it'll be impossible to find any of my users
  • I have modified the modification where we have a login with space or '.' and '@' (for login mail), I keep the original value and use a xwiki login like for the creation of the user in xwiki. Like this, I use the original format for LDAP request and modified one for XWIKI interaction.

Thanks a lot for your work, it was interesting for me to code in java (but I prefer my beloved Python).


Mike Agafonov added a comment - 07/Nov/07 15:31
Hi!
I'm trying to get my xWiki configured so it could be possible to use login credentials from external AD (I do not have access to LDAP configuration files, I can only edit my xWiki). I changed some code in xwiki.cfg, and now I can login to xWiki, but the only thing I see is my surname in the upper corner and an error: "You are not allowed to view this page...".

Vincent Massol added a comment - 10/Jan/08 12:05
Mike that's what this extension does: use ldap groups instead of xwiki groups...

Vincent Massol added a comment - 10/Jan/08 12:06
Hi Gunter,

Thanks a lot for this. What's the state of this extension?

I'd like to commit in xwiki core but I'm no LDAP expert.

Is it finished? From the comments it seems there are some open issues?

Thanks


Ricardo Rodríguez added a comment - 20/Jan/08 11:59
Updated LDAPAuthenticater.class, as per June the 18th, 2007, compiled with the original Cache.jar included in ldap.zip and libraries from XWiki 1.2.

../xwiki/WEB-INF/lib/xwiki-core-1.2.jar
../xwiki/WEB-INF/lib/securityfilter-2.0.jar
./xwiki/WEB-INF/lib/commons-lang-2.1.jar
./xwiki/WEB-INF/lib/commons-logging-1.1.1.jar
./xwiki/WEB-INF/lib/ldap-UNKNOWN.jar
../xwiki/WEB-INF/classes


Tobias Roth added a comment - 21/Jan/08 14:06
Hi Vincent

I tried to email Gunter some time ago to ask about this patch, but I couldn't get a hold of him. It looks like he has left the company under whose employment he coded this stuff, and he also moved to another country. No idea whether he is still interested in XWiki or not.

Thanks,
Tobias


Vincent Massol added a comment - 21/Jan/08 14:15
Hi Tobias,

Thanks for the heads up. Then I guess we need to finish this without him. Anyone tried Ricardo's last modification?

Also, Ricardo and all, do you know if the patch is complete and can be applied as is or are there still some missing things before it can be applied to xwiki's source code?

Thanks
-Vincent


Ricardo Rodríguez added a comment - 21/Jan/08 16:59
Vincent, all,

On my side, there are still a number of issues I've not checked yet. I don't know if they are misconfiguration of my xwiki.cfg or "real" issues with the code. I'm still trying to understand how does the extension work (I'm new to Java, new to Maven, new to Eclipse,...) even though I think the work flow is clear in the original code posted by Gunter. I think you can not rely on me at this moment to decide if the patch can be applied to xwiki's source code.

I keep working and posting here my results.

BTW, I can only test against eDirectory installations here, but if somebody can offer a connection to other LDAP enabled directory I am ready to try with it. Thanks.

Cheers,

Ricardo


Jimmy Champion added a comment - 04/Feb/08 19:08
All,

Has there been any update on this issue? I am currently evaluating several FOSS wiki's, and being able to set permissions based on LDAP groups is a crucial requirement. Has this functionality been included in the 1.3 Milestone release that went out recently? I would be happy to test against my LDAP configuration if necessary.

Thanks,
Jimmy


Vincent Massol added a comment - 04/Feb/08 21:09
Hi Jimmy,

I've got some good news for you. Thomas Mortagne is working on implementing LDAP groups for XWiki and on applying this patch. It should be ready for version 1.3M2 (i.e. for the 15th of February).

I'm pretty sure Thomas would love to get your help for testing what he's coding right now and as soon as he's got something working. We're all pretty new to LDAP here so the more testers the better.

Thanks for the offer.
-Vincent


Thomas Mortagne added a comment - 05/Feb/08 10:13
Hi,

As Vincent said I'm looking for adding groups support to XWiki LDAP and for now I'm fixing some problems in this patch about XWiki api use, documentation etc. As soon as I will finish the cleaning I will repost it as a real patch in this issue then continue work and testing based on it. I'm not a LDAP expert so it takes some times (in fact it's the first time I'm using it), sorry

Thanks,
Thomas


Thomas Mortagne added a comment - 06/Feb/08 16:27
new_ldap_auth.patch : here a first cleaned patch of previous implementations
  • some corrections in XWiki api use
  • java 1.4 (I would prefer to work with java 1.5 but for now XWiki is generally 1.4)
  • some checkstyle correction

It's here mainly for review as a did not tested yet and I'm pretty sure I broke things but feel free to test anyway

Next step is finish checkstyles fixes to be fully XWiki Checkstyle compliant and create some unit tests to test it.
Hope Friday for the next patch.


Thomas Mortagne added a comment - 07/Feb/08 12:30
20080207-new_ldap_auth.patch:
  • forgot to init group cache

Jimmy Champion added a comment - 07/Feb/08 15:32
Thomas,

Thanks for the update. I will attempt to add the patch and test it out against my LDAP configuration. Unfortunately, I'm not an LDAP expert either .

I had another question that I will post here, but probably belongs elsewhere. Why won't XWiki allow usernames to contain a period, (i.e. firstname.lastname)? My client uses a naming convention similar to this for their usernames, so it is important that we carry over support for this in the Wiki product we choose. Browsing through the source code I have noticed that you check to see if the username begins with "XWiki.".

Instead of checking to see if there is a period in the username, could the code be modified to be more specific. For example, instead of:

userName.indexOf(".");

could this code be modifed to something like:

if(userName.beginsWith("XWiki.")) { ... }

Obviously, I am new to XWiki so there is probably a good reason for this restriction on usernames, but I was just hoping to get some clarification and possibly a workaround so we can support our client's needs.

Thanks again for all of your help.

Jimmy


Sergiu Dumitriu added a comment - 07/Feb/08 15:56
About names with dots, the problem is that the username will be used as a document name. And for the moment, a document name cannot include dots, as dots are used as the separator between the space name and the document name. And for the moment there is no working escape strategy possible, as the escapes/unescapes in XWiki are pretty messed up.

(A solution would be to accept dots in the displayed name, but use an escape when working with the name inside the code, but as I said, the escapes don't work well in XWiki)


Thomas Mortagne added a comment - 08/Feb/08 11:11
You are right that it's a problem but as Sergiu said it's difficult yet to manage user name containing point in a general way because in XWiki all is wiki page and "." is a separator.

Now in the LDAP particular case, as the login entered by the user is not directly used as wiki page but is used to access LDAP, I could look at this and see if something can be done. But for now the target is to clean and correctly tests this patch to replace actual LDAP authentication service thanks to Gunter


Thomas Mortagne added a comment - 08/Feb/08 11:37
20080208-new_ldap_auth.patch : lets call it morning build :
  • created a XWikiLDAPConnection containing LDAP tools and moved it in the LDAP plugin
  • created a XWikiLDAPConfig containing xwiki.cfg and XWikiPreferences LDAP options access and moved it in the LDAP plugin
  • started cut authenticate() in other methods

Starting now to test and write some unit tests.


Thomas Mortagne added a comment - 11/Feb/08 15:15
It seems that this implementation never create groups in XWiki database and read a xwiki.cfg parameter listing groups names mapping between ldap and XWiki (unless I did not understood somthing).

Is the people that already tested it can confirm this ?

In that case do you think is enought or de we really need to dynamically get users groups and sync them in XWiki database like we do for users ?

Any way this will have to be done sooner or latter but as I don't use LDAP a lot I'm asking if the way it's working actually is totally useless or can be correct for a first LDAP groups support implementation.


Thomas Mortagne added a comment - 11/Feb/08 17:14
20080211-new_ldap_auth.patch:
  • created XWikiLDAPUtils class containing methods from XWikiLDAPConnection which does not need direct access to LDAPConnection
  • adding first unit tests based on embedded ApacheDS (http://directory.apache.org) 1.0.2 LDAP server in wiki-core. I think most if not all will move to XE misc-test project because for each test a server is initialised, started then cleaned which could me long for a unit test when xwiki-core already contains lots.
  • fixed a bug in the way groups members are retrieved

Shiva Shankar added a comment - 12/Feb/08 16:53
Hi
This is a very critical feature for us to use XWiki in our organization. I am willing to test the patches against our corporate Microsft Active Directory. However, not being a Java developer myself, it would be very useful to have a compiled jar to help me do this.
Any help would be great.

Thomas Mortagne added a comment - 12/Feb/08 17:31
20080212-new_ldap_auth.zip: contains
  • patch with some checkstyle improvements (the only thing remains I think is the too big "authenticate" method)
  • patched xwiki-core 1.2 for every one to be able to easily test it
  • a example of xwiki.cfg parameters used for LDAP

Thomas Mortagne added a comment - 12/Feb/08 23:53
I'm not sure I was clear in the previous comment : when I say patched xwiki-core I mean xwiki-core jar containing this patch modifications.

Shiva Shankar added a comment - 13/Feb/08 17:38
Hi Thomas,
I copied the xwiki-core.jar over the existing xwiki-core-1.2.1.jar in WEB-INF/lib and restarted Tomcat. However, the same issue still persists. Looks like the users are not being created locally even now.
Let me know if i need to do anything differently.

Thomas Mortagne added a comment - 13/Feb/08 17:50
Hi,

Do you have anything in xwiki.log file ?
Is your ldap configuration in xwiki.cfg follow Active Directory ldap schema (user mapping, uid...) ? I did not tested myself on Active Directory, just ApacheDS and the example in the zip file in for ApacheDS server configuration.


Thomas Mortagne added a comment - 13/Feb/08 17:57
XWiki.zip file attached by Gunter contains more details on possible configuration (except for LDAPAuthenticater which I renamed in XWikiLDAPAuthServiceImpl).

Thomas Mortagne added a comment - 13/Feb/08 18:05
I just committed the new experimental LDAP authentication service in xwiki trunk (1.3-SNAPSHOT) for more people to be able to test it. You will find the last build in http://maven.xwiki.org/snapshots/com/xpn/xwiki/platform/xwiki-core/1.3-SNAPSHOT/ as soon as Team City will build it.

I have problem with apacheds+maven to launch integration tests so I'm workling on it now to be able to add more tests and commit them.


Thomas Mortagne added a comment - 19/Feb/08 11:03
Updated issue description