Win2k LDAP Server Authentication

Author Message

Ashley Knowles

Monday 26 September 2005 11:36:13 pm

Okay I am running a multidomain Active Directory tree here, and users must therefore logon to the LDAP server in the form <username>@<domain name>.

The problem being with this is that the SAM Account Name is not equal to <username>@<domain name>.

I have tried modifying the source code, in the files mentioned in the AD 2003 Hack, but still cannot manage to get it right.

If anyone could let me know how the config file should be setup to work with Active Directory then that would be great. In particular the group related fields as I cannot seem to find any information on what these actually do or what they should reference.

Ashley Knowles

Tuesday 27 September 2005 11:20:50 pm

Further to this, AD stores usernames in the LDAP field "samaccountname". As people logon using username@domain, when ez publish queries the LDAP server, it cannot find username@domain, because samaccountname only holds the username part.

Ashley Knowles

Tuesday 04 October 2005 8:08:04 pm

*bump*

Anybody at all got an idea?

Gunnstein Lye

Friday 14 October 2005 1:56:46 am

Did you find out anything? If not, I'll try to answer this soon.

(I'll wait for your reply.)

best regards

Ashley Knowles

Monday 07 November 2005 6:35:31 pm

Absolutely nothing....

Gunnstein Lye

Tuesday 08 November 2005 1:19:51 am

Allright then, I'll give it a shot. Disclaimer: I know nothing about Active Directory.

First: If your LDAP server does not allow anonymous bind, then you need the support for authenticated bind which will be in 3.8. You can get it in the svn.

Second, the LDAP version number must be correct, either 2 or 3 at the moment. I don't know what is correct for Active Directory, but its documentation should specify it.

Skip the search filters, at least to begin with.

The login attribute refers to the attribute in your LDAP login which should be used as the users' login.

eZ publish needs to store the ldap users as local eZ publish users, in order to use them. More about this in the next 4 paragraphs:

The LDAPUserGroupType and LDAPUserGroup are related. If the LDAPUserGroupType is id, then the LDAPUserGroup refers to content object ids of eZ publish user groups. If it is name, the LDAPUserGroup refers to names of eZ publish user groups.

If the LDAPUserGroup is an array, then the first one will be the default placement of ldap users. If it's not, then all ldap users are stored in the same eZ publish user group.

LDAPUserGroupAttributeType and LDAPUserGroupAttribute are used to specify which attribute of the ldap user object eZ publish should use when deciding where to place the users.

So, an example:
LDAPUserGroupType=name
LDAPUserGroup[]=Default
LDAPUserGroup[]=Secretary
LDAPUserGroup[]=Clerk
LDAPUserGroup[]=Boss
LDAPUserGroupAttributeType=name
LDAPUserGroupAttribute=employeetype
Now, when logging in, eZ publish looks at the LDAP object, and finds the attribute whose name is employeetype, and reads its value. Then, eZ publish searches for an eZ publish user group whose name equals the given value. If it is found, then the user is stored there. If not, it is stored in Default. That should cover the user group settings.

The first name, last name and email settings are used when storing the eZ publish copy of the user.

Now, to the SAM account name. You can either:
- Set LDAPLoginAttribute=samaccountname, and tell people to login with just username, instead of username@domainname, or:

- Find (or create) an LDAP attribute that contains the entire username@domainname, and set LDAPLoginAttribute to that, or, if that is not possible:

- Last solution: If you can not get the entire username@domainname as one single LDAP attribute, then you need to add support for using several attributes. You could set LDAPLoginAttribute=samaccountname@domain (given that the attribute "domain" contains the users domain), and then add the necessary code in kernel/classes/datatypes/ezuser/ezldapuser.php. The relevant part is around line 242 (in 3.8 svn): $LDAPFilter .= "($LDAPLogin=$login)";
Here you need to split $LDAPLogin and $login by "@", and change the filter a bit. Something like this, I think:
$LDAPFilter .= "($LDAPLoginPart1=$loginPart1)";
$LDAPFilter .= "($LDAPLoginPart2=$loginPart2)";

This is very experimental and hypothetical, of course. I hope you don't need to resort to this. If you do, we should add this feature to the distribution.

I hope this helps!

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 19:11:25
Script start
Timing: Jan 18 2025 19:11:25
Module start 'layout'
Timing: Jan 18 2025 19:11:25
Module start 'content'
Timing: Jan 18 2025 19:11:26
Module end 'content'
Timing: Jan 18 2025 19:11:26
Script end

Main resources:

Total runtime0.8359 sec
Peak memory usage4,096.0000 KB
Database Queries66

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0045 590.3438152.6406
Module start 'layout' 0.00450.0021 742.984439.4766
Module start 'content' 0.00660.8277 782.4609549.8984
Module end 'content' 0.83430.0016 1,332.359416.1406
Script end 0.8359  1,348.5000 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00300.3562160.0002
Check MTime0.00120.1465160.0001
Mysql Total
Database connection0.00080.098610.0008
Mysqli_queries0.774692.6681660.0117
Looping result0.00060.0730640.0000
Template Total0.804396.220.4022
Template load0.00210.247920.0010
Template processing0.802295.969620.4011
Template load and register function0.00030.030410.0003
states
state_id_array0.00080.100910.0008
state_identifier_array0.00070.084820.0004
Override
Cache load0.00180.2167490.0000
Sytem overhead
Fetch class attribute can translate value0.00060.074920.0003
Fetch class attribute name0.00120.140870.0002
XML
Image XML parsing0.00090.104920.0004
class_abstraction
Instantiating content class attribute0.00000.001980.0000
General
dbfile0.00090.1059160.0001
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 22
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs