Hi,
It worked well before and suddenly stopped working today... When a user logs in through CAS (I'm using rubycas-server), he is redirected to the drupal server with the ticket information, the ticket is validated according to the debug log but then the user is redirected to /en/cas?destination=user and then again to the CAS server...
I guess it's probably a stupid error somewhere on my part, but I've spent hours on this and I'm stumped. I've attached the file for this.
Thanks, and thanks for your work on the CAS module.
Happy new year!
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | log.txt | 4.72 KB | ewitchin |
| debug_cas.txt | 36.94 KB | giom |
Comments
Comment #1
bfroehle commentedHi Guillaume: Thanks for the debug log --- it is very helpful in diagnosing these problems.
In this case, it appears that CAS is successfully authenticating the user, but somehow the user's session is not being saved. I've seen this sort of error in the past, and I think it was due to a misconfiguration of PHP, not Drupal, cas.module, or phpCAS.
For debugging, I think the next step would be to see if you can use phpCAS separately from Drupal. For example, grab example_simple.php and config.php.example. Rename the latter file to config.php, and set your CAS host, port, etc in there. Then go try out example_simple.php and see if it works!
Comment #2
giom commentedHi,
Thanks! Indeed I get the same issue when using phpCAS directly... I wonder what could have changed to create problems... I'm using php-fpm and nginx which I guess is not also that standard.
Comment #3
bfroehle commentedMake sure the directory or database or whatever php uses to store its sessions is writable by the php process. Hope you can get it working!
Comment #4
giom commentedWell, that was the issue when testing with example_simple.php and it does work with that now.
But, it still doesn't work with drupal... One thing I've noticed is that it says: "Skipping session rename since phpCAS is not handling the session. [Client.php:2987]" in the log, I wonder if that would be related?
One thing to note too is that login in without CAS works, so I don't think the sessions is an issue on the drupal side...
Comment #5
bfroehle commentedThis is desired behavior --- we need Drupal to handle the session, not phpCAS.
Comment #6
bfroehle commentedI assume that the support request has been resolved since we haven't heard from the original poster in several months.
Comment #8
ewitchin commentedSorry to bring up this topic again, but I am having a similar issue. The example_simple.php works fine, however when going through Drupal i get a redirect loop.
Any insight to this would be greatly appreciated. I have attached a log file. Within the log the 2 blocks of output will show about 6 times (hence the redirect loop). To me it seems like there might be an issue with session being lost, but I am not 100% on that.
Thanks in advance,
Eric
Comment #9
bfroehle commentedYes, it looks like the Drupal session is getting lost. Can you log in to Drupal regularly? Are you using Pressflow?
Comment #10
ewitchin commentedI can login with a regular Drupal user no problem and as far as I know I am not using Pressflow.
Comment #11
ewitchin commentedI have also noticed that the cas module is not creating a Drupal user even though I have the checkbox for it checked. I don't know if this will help pinpoint the issue any better.
Comment #12
bfroehle commentedYes, that is consistent with what you have described. The CAS.module calls
phpCAS::authenticate()however that command never returns successfully --- it gets stuck in the infinite redirect loop there.I'm surprised that example_simple.php works for you... I've never seen a case yet where that worked but Drupal didn't. Is there anything else potentially unusual about your setup?
Comment #13
metzlerd commentedIs your site in maintenance mode by any chance?
Comment #14
ewitchin commentedWe migrated this website from a different server and we have verified all owner/permission are correct. We are running php 5.3 through suPHP on a server running cPanel/WHM. We are unsure if it is a server configuration, however all the required modules are in place and we have validated with the curl response. I will try to setup some debugging/logging within the authenticate function to try and pinpoint this a little better on our end. Any more insight you can provide would be greatly appreciated.
Thank you for your help up to this point!
Eric
Comment #15
ewitchin commentedThe site is online
Comment #16
ewitchin commentedAfter some searching it appears my version of phpCAS that I am using (1.2.2) does not have a phpCAS::authenticate() function within it. Am I using a wrong combo of the CAS module and phpCAS?
Thanks,
Eric
Comment #17
bfroehle commentedSorry, I meant "phpCAS::forceAuthentication()". Nonetheless you probably want to upgrade to 1.3.0 or later for security reasons.
Comment #18
ewitchin commentedI have noticed there is a forceAuthentication function that I believe it is using. I have also upgraded the phpCAS 1.3.1 right now and still have the same issue.
Comment #19
ewitchin commentedThe function seems to die when this line of code is called
$auth = self::$_PHPCAS_CLIENT->forceAuthentication();around line 1100.Comment #20
ewitchin commentedSo we have discovered the issue. It turns out during migration the table would not allow for a uid of 0 within the users table. We modified the table within the database to do so and set the uid column value to 0 for the blank user. Everything is working as expected now. Thank you for your help in helping me debug this issue. It was greatly appreciated.