My setup: Drupal 7.19 / IIS 7.5 / SQL Server 2008

My issues:

  1. Single Sign-On > When "Turn on automated single sign-on" is checked and I log out and visit user/login/sso, I receive these messages:

    "Sorry, your LDAP credentials were not found, or the LDAP server is not available. You may log in with other credentials on the user login form."
  2. When I click on the "Update" button under the Authentication tab, I receive these notices:

    "Notice: Trying to get property of non-object in drupal_lookup_path() (line 77 of E:\inetpub\wwwroot\drupal\includes\path.inc)."

    "Notice: Undefined offset: 0 in LdapAuthenticationConfAdmin->validate() (line 534 of E:\inetpub\wwwroot\drupal\sites\all\modules\ldap\ldap_authentication\LdapAuthenticationConfAdmin.class.php)."

    "Notice: Trying to get property of non-object in LdapAuthenticationConfAdmin->validate() (line 534 of E:\inetpub\wwwroot\drupal\sites\all\modules\ldap\ldap_authentication\LdapAuthenticationConfAdmin.class.php)."

    "Notice: Undefined offset: 0 in LdapAuthenticationConfAdmin->validate() (line 534 of E:\inetpub\wwwroot\drupal\sites\all\modules\ldap\ldap_authentication\LdapAuthenticationConfAdmin.class.php)."

    "Notice: Trying to get property of non-object in LdapAuthenticationConfAdmin->validate() (line 534 of E:\inetpub\wwwroot\drupal\sites\all\modules\ldap\ldap_authentication\LdapAuthenticationConfAdmin.class.php)."

    This only started after I unsucessfully tried to update from 7.x-1.0-beta12 to 7.x-2.0-beta3.

Sorry for the multiple issues. I didn't find anything on them and I wanted to follow the rules for this issue queue. Thanks for any help.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

johnbarclay’s picture

Status: Active » Postponed (maintainer needs more info)

Can you test against 7.x-1.0-dev or 7.x-2.0-dev and change the version to the one you decide to test against.

katannshaw’s picture

Sure. I can test against either of those versions. Which one do you feel would be preferable?

katannshaw’s picture

I went ahead and tried both versions, starting with 7.x-1.x-dev since it's the closest to what's currently working for me with 7.x-1.0-beta12. Here is what happened:

Attempt 1 - Installed 7.x-1.x-dev:

  1. It now says 7.x-1.0-beta12+12-dev under the Config > Modules. Is this what it's supposed to say?
  2. There were no database updates listed on the update script.
  3. As I went to the following tabs and clicked on the Update buttons, this is what happened:
    • Settings > Everything worked fine.
    • Servers > Everything worked fine.
    • Authentication > Received the same notice errors as in my original post.
    • Authorization > Everything worked fine.
    • Queries > Everything worked fine.
    • Profile Mapping > Everything worked fine.
    • Help > Everything worked fine.

************************************

Attempt 2 - Installed 7.x-2.x-dev:

  1. It now says 7.x-1.0-beta12+12-dev under the Config > Modules. Is this what it's supposed to say?
  2. These 4 pending updates appeared before running the update script:

    ldap_authorization module

    7201 - moving some groups related fields into ldap server module
    7202 - remove user ldap authorizations field. its in $user->data now
    7203 - make all schema field names lowercase in ldap server to deal with cronic case sensitivity issues

    ldap_query module

    7102 - make ldap_query.scope field small int instead of tiny int for ctools bug

  3. Ran the update script, and I received this fatal error:

    Fatal error: Call to undefined function ldap_servers_module_load_include() in E:\inetpub\wwwroot\drupal\sites\all\modules\ldap\ldap_query\ldap_query.module on line 116
  4. As I went to the following tabs and clicked on the Update buttons, this is what happened:
    • Settings > Everything worked fine.
    • Servers > Everything worked fine.
    • Authentication > Received the same notice errors as in my original post.
    • Authorization > Page went blank.
    • Queries > Page went blank.
    • Profile Mapping > Everything worked fine.
    • Help > When I clicked on "Issue Reporting" the page was blank.

I'm now going to pull back in my backup core and database files, and revert back to 7.x-1.0-beta12 until these issues are resolved. I hope that the information helps.

katannshaw’s picture

@johnbarclay: Is there any word on this issue report?

Within my setup of IIS 7.5, Authenticated and Anonymous users are allowed. But I'm still not able to use SSO without receiving this message when visiting user/login/sso:

"You were not authenticated by the server. You may log in with your credentials below."

If I create a simple test PHP file within the drupal core to display my username, it works great. So I'm not sure why this page isn't seeing my username. Do you have any suggestions?

johnbarclay’s picture

In starting to debug this, I found an error that made ldap_sso non functional; I'm not saying it works now but it couldn't work before. Here is the commit http://drupalcode.org/project/ldap.git/commitdiff/3760bd5 and its in 7.x-2.x-dev.

If this fixes it great. If not...

I believe the error is #3 is taken care of. I would suggest running the schema module to make sure the database is in synch with the ldap_* modules.

As far as debugging the issue within ldap_sso, here are some steps:

- trace the function ldap_sso_boot() and ldap_sso_user_login_sso() in ldap_sso.module. If you don't have tracing setup, you can also enable detailed logging at admin/config/people/ldap (checkbox on bottom) and add more watchdog statements.

trumanru’s picture

It doesn't work completely!!! Site got WSOD on any page (<front>, user/login and user/login/sso).
Apache error log has a error:
PHP Fatal error: Using $this when not in object context in C:\\www\\portal\\sites\\all\\modules\\ldap\\ldap_sso\\ldap_sso.module on line 106

upd:
I've removed "$this->" from line 106 in ldap_sso.module and everything was working, includes LDAP SSO Authentication.

Thanks!

upd2:
It's not true. Sorry.
And it was about 7.x-2.0-dev version.
So sorry.

katannshaw’s picture

@johnbarclay: Thanks for the new information. I just tried installing 7.x-2.x-dev with the new code that was committed on Feb 26th, but unfortunately I received the same errors and issues as I reported on comment #3.

I did look at the Watchdog report, and this is what I saw displayed 4 times:

Watchdog:

Type	ldap
Date	Wednesday, February 27, 2013 - 10:40
User	jayhawkfan75
Location	http://mysite/drupal/admin/config/people/ldap/profile?render=overlay
Referrer	http://mysite/drupal/welcome
Message	LDAP ldap_search error. basedn: ou=guest accounts,dc=ad,dc=myuniveristy,dc=edu| filter: (sAMAccountName=jdoe)| attributes: Array ( ) | errmsg: Can't contact LDAP server| ldap err no: -1|
Severity	notice
Hostname	123.45.6.789
Operations	

Since it had an issue with the test account from Simpletest within LDAP, I then tried to disable test account and received the following error:

PDOException: SQLSTATE[23000]: [Microsoft][SQL Server Native Client 10.0][SQL Server]Cannot insert the value NULL into column 'account_name_attr', table 'Drupal.dbo.ldap_servers'; column does not allow nulls. INSERT fails. in drupal_write_record() (line 7106 of E:\mysite\drupal\includes\common.inc).

I then tried to disable Ldap Authorization SimpleTest module all-together and it crashed the site.

I finally tried to run the update script with the same updates listed as on #3, and received the same fatal error:

Result = Fatal error: Call to undefined function ldap_servers_module_load_include() in E:\mysite\drupal\sites\all\modules\ldap\ldap_query\ldap_query.module on line 116

So I'm now reverting back to 7.x-1.0-beta12. Do you believe that I should try installing a patch to beta12? If so, do you have a link to it?

Additional Note: I installed the Schema module per your suggestion, but it crashed by config page. So I disabled and uninstalled it.

Update:

As far as debugging the issue within ldap_sso, here are some steps:

- trace the function ldap_sso_boot() and ldap_sso_user_login_sso() in ldap_sso.module. If you don't have tracing setup, you can also enable detailed logging at admin/config/people/ldap (checkbox on bottom) and add more watchdog statements.

I do have that Detailed Watchdog checkbox checked, but no logs are displayed even though I receive that authentication error. Also, an important note that I mentioned earlier is that on the same server within the Drupal core's folders I have the following simple PHP script to see if it's pulling my Windows username, which it is doing successfully:

<?php
        // check Windows credentials
        $varUserName = $_SERVER["REMOTE_USER"];
        echo $varUserName;
        ?>

I also successfully changed line 112 in ldap_sso.module so that my static username was used ($remote_user = 'myusername';) and went to user/login/sso, and it worked. So for some reason, $remote_user = $_SERVER['REMOTE_USER']; is not getting my username. Hope it helps. Strange...

trumanru’s picture

johnbarclay, are you sure about $this object in line 106 of ldap_sso.module ?

+ if (in_array($path, $this->ldap_sso_default_excluded_paths())) {
+    return TRUE;
+  }

If it is set I get WSOD.

But if I remove it, I can't login by SSO with multiple (two or more) "green colored" messages:

  • You have been successfully authenticated
  • You have been successfully authenticated

After this messages user stayed unregistered as an anonymous.

johnbarclay’s picture

should be:

if (in_array($path, ldap_sso_default_excluded_paths())) {
return TRUE;
}

thanks.

johnbarclay’s picture

The change for comment #8 and #9 is committed to 7.x-2.x-dev.

trumanru’s picture

Version: 7.x-1.0-beta12 » 7.x-2.0-beta4

Still couldn't login with applied #9 change.

Only one green colored message "You have been successfully authenticated" after SSO login try but after that user still unregistered - user/login accessible and user/logout inaccessible.

johnbarclay’s picture

Version: 7.x-2.0-beta4 » 7.x-2.x-dev
Status: Postponed (maintainer needs more info) » Active
trumanru’s picture

johnbarclay, how can I help you to resolve this problem?

johnbarclay’s picture

There are a couple approaches to solving this. These apply to any ldap views, ldap feeds, or ldap sso issues since they are modules I don't use and don't have test coverage:

  1. If you are a programmer, debug and submit a patch.
  2. If you are not, buy 2 or 4 hours of someone using ldap sso to write a patch. You can find other coders that use ldap sso by looking through the issue queue. hotspoons wrote the initial code. jayhawkfan75 seems to have a handle on the issue also.
  3. Try mixing an earlier version of ldap_sso with all the other current ldap_* modules. Perhaps even the 7,x-1.x branch. This may help isolate the issue if you can get one to work.
katannshaw’s picture

LDAP SSO still isn't working for me properly, because it's not pulling in the AD username like I mentioned on #7.

I have a friend and fellow Drupal developer who's going to try to help me to finish it up next Monday, and I'll make sure that I post anything that I learn about it on here. Hopefully we're able to come up with that the issue is and a resolution.

johnbarclay’s picture

Great. thanks. This one is killing me because I have no good way to test.

BTW I have the outline of the simpletest at: http://drupalcode.org/project/ldap.git/blob/8eca3972160d8161d15a0252ceac...

It just iterates over the possible sso configuration permutations and for each attempts to set the environment variables. Its lacks assertions for success or failure in the middle of the loop. And I'm not sure if its setting the environment variables correctly

klavs’s picture

Is this the same error as mine? I use beta4 - and I get redirected to /usr/login/sso - which authenticates me fine (using kerberos), and then redirects me to / - setting a message with "User successfully authenticated".

Problem is, that I'm not actually logged into Drupal - which works fine in beta1.

I can't seem to figure, WHAT the module actually does - to ensure I get a login cookie on autologin? I can't see anything looking like that in ldap_sso_boot function - except this:
setcookie("seamless_login_attempted", 'true', time() + (int)$ldap_authentication_conf['cookieExpire'], base_path(), "");
$_SESSION['seamless_login_attempted'] = $login_attempted;

And that looks, as far as I can see, exactly the same as in Beta1 :(

katannshaw’s picture

@klavs: I'm using LDAP version 7.x-1.0-beta12, as I had some issues with the newer versions, and was advised to stick with what's working for me until an release candidate/RC version is released. I was able to find a solution for getting my Windows username pulled in with IIS and Drupal, which I've listed below. Not sure if you can revert back to the version I'm using to see if it works, but if you can, that may be a good option. Hope it helps.

@johnbarclay: I was able to do the testing on the LDAP SSO module with my friend, and we were able to solve one major problem with my setup of this module.

We noticed that a test PHP page I created pulled in my username without a problem, ldap_sso.module file wouldn't do that. So after a lot of debugging, we tried something within IIS Manager (7.5). Once I disabled Anonymous access and enabled Windows Authentication at the root level of the site, my AD username was pulled in properly, and the user/login/sso page automatically logged me in as it should. Yea!!!

I next tried to do the same setup from the ldap module's root and ldap sso root instead of the root of the site, but that didn't work. So I reverted back to what worked previously.

The only issue I have with this setup is that some employees from one department that do not have AD/domain accounts, and they will want to access the site anonymously without creating a Drupal account. This is an intranet site, and the only way to allow them in is to allow for anonymous access. But obviously this setup won't allow for that. Do you have any suggestions on how what my next step should be?

Concerning the notices I mentioned in my original post (#2), I'm still getting them whenever I click on the save button on the "Authentication tab. Do you have any progress on that issue?

klavs’s picture

@jayhawkfan75: I've got 7.x-2.0-beta1 working perfectly - so no need to go all the way back to 1.0 :)

With 2.0-beta1 and mod_auth_kerb (what we're using) this just works, as long as you've gotten a keytab from the windows AD on the Drupal site, and setup the client to include the url in the local intranet zone (otherwise it won't send a kerberos ticket).

I don't believe yours and mine issue is related at all.

@johnbarclay: perhaps I should start a new issue - since it seems not to be the same issue as the original reporter of this issue has ?

johnbarclay’s picture

I see one issue is just a documentation one and possibly some better error catching. Another is related to authenticated users which are partially logged in in some way. I also see some redirects issues. If someone can just search on SSO and start one issue for each distinct bug, that might help. With good titles.

But this thread is fine if the people using it are following it.

johnbarclay’s picture

Title: LDAP Authentication and SSO: Cannot get SSO to work » LDAP SSO: Undefined offset: 0 in LdapAuthenticationConfAdmin->validate()

I've changed this back to the original issue in the title. Looks like the original issue may be some server configuration issues. Make sure the list of servers in the ldap_servers table is correct. Delete and recreate them with the same server ids.

johnbarclay’s picture

FileSize
503.44 KB
365.67 KB

Attached are diffs of beta2-3, beta3-4, and beta4-5 for those trying to figure out what broke after beta2.

2-3 looks like ssopExcludedPaths in LdapAuthenticationConf is the only related change, perhaps the fix of authname and accountname differentiation in ldap authentication.

3-4 looks like ssoExcludedHosts and ldap_authentication/ldap_authentication.inc validation sequence with ldap_authentication_test_credentials() function are the related changes. These are quite substantial logon form validation changes.

It would be useful to know which beta or commit broke things. And the configuration of sso that its broken for.

haydeniv’s picture

With regard to #18

The only issue I have with this setup is that some employees from one department that do not have AD/domain accounts, and they will want to access the site anonymously without creating a Drupal account. This is an intranet site, and the only way to allow them in is to allow for anonymous access. But obviously this setup won't allow for that. Do you have any suggestions on how what my next step should be?

What you will want to do is uncheck the box for "Turn on automated/seamless single sign-on" under the Single Sign-On settings. Now your site will follow normal permissions so anonymous users can see the pages. On pages that require the user to be authenticated you just need to redirect them to user/login/sso. As long as the single sign on module is enabled SSO will still work at that path. The only trouble is you can't just set the 403 page under System Settings to be user/login/sso because it will cause an infinite loop to occur so you will need some other module or some custom code to do an actual redirect to user/login/sso.

Hope that helps.

With regard to #1, I've found that the leap from 1.x to 2.x can be unpleasant and it is better to completely uninstall the module configuration and everything and install 2.x from scratch and reconfigure everything.

katannshaw’s picture

@haydeniv: Thanks for the reply. I have "Turn on automated/seamless single sign-on" unchecked, so I'm not prompted when I visit the regular pages of the site as you've stated.

But my issue is that if I have Anonymous and Windows Authentication enabled on the server, and I go to user/login/sso, it does not detect my Windows credentials and gives me the following message: "Sorry, your LDAP credentials were not found, or the LDAP server is not available. You may log in with other credentials on the user login form."

The only way that the user/login/sso page works is for me to disable Anonymous users in IIS Manager, which is not a workable solution when some users will be Anonymous.

Thanks again for any assistance.

haydeniv’s picture

I'm not certain how to configure IIS. I use CentOS and NTLM authentication for mine. Basically you need to configure IIS to only require authentication when the specific path is detected /user/login/sso Otherwise everyone else is just anonymous.

haydeniv’s picture

Status: Active » Fixed

I'm going to go ahead and mark this one as fixed as the original problem is not an issue anymore. Feel free to open a new support request if you are still having trouble getting your IIS configured that way everyone on this thread isn't getting notified for these unrelated updates. Although I don't know how much help we will be with it.

katannshaw’s picture

These specific issues have been fixed for me after updating my LDAP version from 7.x-1.x-beta12 to 7.x-2.x-beta5. I'm still having some issues with SSO, but I'll have to create a new issue report for that, as it's unrelated to this original issue report. Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.