authLDAP

This is a plugin that allows you use your LDAP to authenticate and authorise users to access your wordpress web-log.

Installation should be as simple as instalaltion of every wordpress-plugin. Simply unzip the downloaded file, put it into your wordpress-installations plugins-folder and activate it.

After activation you can configure the plugin via the options-panel.

How does the plugin work?

Well, as a matter of fact it is rather simple. The plugin verifies, that the user seeking authentification can bind to the LDAP using the provided password.

If that is so, the user is either created or updated in the wordpress-user-database. This update includes the provided password (so the wordpress can authenticate users even without the LDAP), the users name according to the authLDAP-preferences and the status of the user depending on the groups-settings of the authLDAP-preferences

 Writing this plugin would not have been as easy as it has been, without the wounderfull plugin of Alistair Young from http://www.weblogs.uhi.ac.uk/sm00ay/?p=45

Configuration

Usage Settings

Enable Authentication via LDAP
Whether you want to enable authLdap for login or not
debug authLdap
When you have problems with authentication via LDAP you can enable a debugging mode here.

Server Settings

LDAP Uri
This is the URI where your ldap-backend can be reached. More information are actually on the Configuration page
Filter
This is the real McCoy! The filter you define here specifies how a user will be found. Before applying the filter a %s will be replaced with the given username. This means, when a user logs in using ‘foobar’ as username the following happens:

uid=%s
check for any LDAP-Entry that has an attribute ‘uid’ with value ‘foobar’
(&(objectclass=posixAccount)((!(uid=%s)(mail=%s)))
check for any LDAP-Entry that has an attribute ‘objectclass’ with value ‘posixAccout’ and either a UID- or a mail-attribute with value ‘foobar’

This filter is rather powerfull if used wisely.

Creating Users

Name-Attribute
Which Attribute from the LDAP contains the Full or the First name of the user trying to log in. This defaults to name
Second Name Attribute
If the above Name-Attribute only contains the First Name of the user you can here specify an Attribute that contains the second name.
This field is empty by default
User-ID Attribute
This field will be used as login-name for wordpress. Please give the Attribute, that is used to identify the user. This should be the same as you used in the above Filter-Option.
This field defaults to uid
Mail Attribute
Which Attribute holds the eMail-Address of the user?
If more than one eMail-Address are stored in the LDAP, only the first given is used
This field defaults to mail
Web-Attribute
If your users have a personal page (URI) stored in the LDAP, it can be provided here.
This field is empty by default

User-Groups for Roles

Group-Attribute
This is the attribute that defines the Group-ID that can be matched against the Groups defined further down
This field defaults to gidNumber.
Group-Filter
Here you can add the filter for selecting groups for the currentlly logged in user
The Filter should contain the string %s which will be replaced by the login-name of the currently logged in


 
 architectural daughtsman, brother, developer, father, husband, master of forestry sciences, scout


59 thoughts on “authLDAP

  1. Hey Julien.

    Yes, the plugin works with AD as well. Can you send me more details on your config via Mail to andreas (AT) heigl (DOT) org? I’ll then try to find the issue!

    Cheers

  2. Hello Andreas,

    i woud like to ask you, wether your plugin is also suitable for the wordpress multisite setup? I only find the settings for authldap in the dedicated wordpress site, and not in the global network dashboard.
    Thanks, and regards,
    Axel

  3. It currently isn’t out of the box. I never got round to implementing it and it wasn’t a requested feature. I might have a look at how to do that during this weekend so I might be able to give you a feedback how and when that might work…

  4. Hello,

    Your plugin is exactly what i am looking for but unfortunately i cannot get it to work. any help would be greatly appreciated.

    Error:(Time on logs are not accurate, not sure if that has anything to do with it)

    [13-Oct-2017 03:17:44 UTC] [AuthLDAP] User ‘userid’ logging in
    [13-Oct-2017 03:17:44 UTC] [AuthLDAP] about to do LDAP authentication
    [13-Oct-2017 03:17:44 UTC] [AuthLDAP] connect to LDAP server
    [13-Oct-2017 03:17:44 UTC] [AuthLDAP] LDAP authentication failed with exception: no result found

    LDAP URI:ldap://myglobalname.com:3268/cn=userid,password,DC=domain,DC=mycorp,DC=com

    Filter: (cn=%)
    Name: givenName
    Last: sn
    UserID Attribute: cn
    Mail: mail

    Group Attribute: distinguishedName

    Group Filter: (&(objectClass=group)(dn=%))

    Mapped group to Subscriber group: CN=groupname,OU=Groups,OU=common,DC=domain,DC=mycorp,DC=com

  5. Hi.

    I‘m pretty sure your LDAP-URI needs to look like this:

    ldap://userid:password@myglobalname.com:3268/DC=domain,DC=mycorp,DC=com
    

    Where „userid“ should be something like „cn=userid,DC=domain,DC=mycorp,DC=com“. When you are using ActiveDirectory as backend you might also able to just use „userid“

  6. Thanks for your reply!

    I am now getting this error: LDAP Authentication failed with exception: bind was not successful: Invalid Credentials

    i tried both cn and userid (lets say my user id is “test” and password is “pass123” here is how i am inputing the LDAP URI –

    ldap://cn=test:pass123@myglobalname.com:3268/DC=domain,DC=mycorp,DC=com

    also tried this, with same error –
    ldap://userid=test:pass123@myglobalname.com:3268/DC=domain,DC=mycorp,DC=com

  7. Try
    ldap://test:pass123@myglobalname.com:3268/DC=domain,DC=mycorp,DC=com or ldap://cn=test,DC=domain,DC=mycorp,DC=com:pass123@myglobalname.com:3268/DC=domain,DC=mycorp,DC=com.

    The username needs to be either a complete Distinguished Name (DN) or – when you are using ActiveDirectory as backend – just the user-ID (that is stored in ActiveDirectory in the attribute sAMAccountName)

  8. Getting the same error with both, we are using forest schema version 47, is there maybe a unique way it needs to be for this schema version?

    User ‘test’ logging in
    about to do LDAP authentication
    connect to LDAP server
    LDAP authentication failed with exception: bind was not successfull: Invalid credentials

Leave a Reply

Your email address will not be published. Required fields are marked *