When I attempt to authenticate via the default REST server configuration that comes with the services module, I am unable to login is an LDAP user. I am able to do so, however, via the browser gui. I am able to login as a non-LDAP user via the REST API. I would like to be able to authenticate via the Services module API as an LDAP user.

CommentFileSizeAuthor
#5 dirty.patch1.11 KBmrryanjohnston

Comments

marcingy’s picture

Status: Active » Closed (won't fix)

You can create a sandbox project to provide authenication via ldap which can be promoted to a full project after it going through the drupal module approval process. Services core will not support LDAP.

mrryanjohnston’s picture

I'm sorry, I forgot to mention: the LDAP authentication is being handled by this module: http://drupal.org/project/ldap I would like to be able to leverage the Services module to authenticate through this module.

marcingy’s picture

So you need to convice the maintainer of the ldap module to include a module that will plugin into the services auth system or build a standalone module that provides the bridge between the ldap module and services.

There is might be be push back from the ldap maintainer about adding a services module, so a new project that you maintain that integrates the 2 seems to be the best way forward for you in my opinion.

mrryanjohnston’s picture

For anyone interested, I posted this in the LDAP issue tracker: http://drupal.org/node/1286790

mrryanjohnston’s picture

StatusFileSize
new1.11 KB

I made a dirty little patch if anyone is interested. I'll work on making this into a services module.

forestmars’s picture

@marcingy - What would be the reason for pushback from the LDAP maintainer on releasing an LDAP sub-module for Services?

marcingy’s picture

That they may not want to maintain a services module if they themselves don't use services.

mrryanjohnston’s picture

So I'm attempting to put together a module for this feature. Here is what I have so far: https://gist.github.com/1237280

Currently, it's exhibiting some weird behavior. I'm using the hook hook_services_resources_alter() in order to redefine the callback function for the user.login method in order to do some specific stuff at login time. The hook seems to fire every time I go to the services page in the web gui, but it only fires the first time after clearing cache when attempting to access the rest service directly (ie with curl). Above all, it never seems to fire my custom callback. MrMaksimize in IRC mentioned it may have something to do with caching, even though I'm clearing my cache after making changes. Thoughts?

johnbarclay’s picture

If services authentication is setup correctly, it should simply leverage the "user" module api for authentication. Ldap authentication or any other credential based external authentication should work. Thinks like openid and cas may have a different workflow that might create problems.

I maintain the ldap project and am not familiar with services authentication so can't say for sure. The "user" module is architected for external authentication mechanisms to plug in to it seamlessly. If this is not the case, I may be able to help.

My understanding is the use case is to authenticate to a webservice with ldap credentials. If this is the use case, an additional module seems like overkill and the request should simply be labelled "Support user module authentication model"

marcingy’s picture

@johnbarclay I think we have a similar issue in the opposite direction. For services authenication equals how am I telling a service that I am given user. In services core 2 schemas exist for this, utilising the standard drupal login mechanism and then providing a sess id to calls after the initial login or by utilising oauth. Does ldap use standard drupal hooks in the area of logging in and subsequently populate the drupal session table?

mrryanjohnston’s picture

I started work on a module as a fix in the mean time: http://drupal.org/sandbox/mrryanjohnston/1289212. I'm running into an issue currently, though; as of right now, services still defaults to using the user_resource.inc file rather than my custom defined function. I think it has something to do with caching, but the fixes that I tried implementing for that did not seem to do the trick. Patches gladly accepted!

mrryanjohnston’s picture

Ok, I seem to have gotten this module working. It's only a sandbox project, so use at your own discretion.

BarisW’s picture

Cool, thanks! Will try it out ;)

jaarong’s picture

Has this been resolved? I am having some problems authenticating with a site that uses LDAP. I'm wondering if Services not integrating well with LDAP might be the problem.