Hi,
I get a redirect loop when attempting to log in with CAS. I'm using Drupal 7.31, phpCAS 1.3.3, PHP 5.3.3, and CAS module v7.x-1.x. I'm using the CAS 2.0 protocol, and I've attached the CAS module's log below of the loop.

CommentFileSizeAuthor
casloop.txt167.97 KBdobie_gillis

Comments

bkosborne’s picture

How the login "initiated" on the Drupal site?

dobie_gillis’s picture

It's an href pointing to /cas.

bkosborne’s picture

Yes you certainly have a redirect loop going on there.

For sanity, I just tested this myself and didn't have a problem. I signed out locally, constructed a URL like this: http://sandbox.local/cas?destination=node/12. And I was properly signed on and then finally redirected to /node/12.

Do you have any other modules enabled that could potentially be messing w/ login? Make sure Cookies are working? Your debug log indicates that after the user has returned to the site, phpCAS finds the service ticket parameter, validates it, and then reloads the page (removing the service ticket parameter from the URL). On the next page load, phpCAS for some reason does NOT recognize that it had previously logged the user in, so it tries to log them in once more.

dobie_gillis’s picture

Thanks for helping me debug this. Cookies seem to be enabled and working (and this occurs in every browser I've tried), and if I manually construct a url like /cas?destination=node/12, I still hit the loop. I'll keep looking.

dobie_gillis’s picture

I've spent the last two days looking through all the CAS module and phpCAS code, and I can't figure out why $_SESSION['phpCAS']['user'] isn't getting set. So annoying.

dobie_gillis’s picture

Version: 7.x-1.4 » 7.x-1.x-dev
dobie_gillis’s picture

Issue summary: View changes
metzlerd’s picture

In most cases this problem has been traced back to problems with session initialization due to some performance optimizing thing that we are not privy to. But to trace this back. Can you verify whether the phpCAS sample code (in a simple php environment) behaves properly on your server? This would help us understand if there is an underlying prolbem with the phpCAS libraries or if it related to the combination of modules that you might be using.

To start with make sure that you have a user account with a cas user name that you are filling in, and that php error reporting is turned on in your dev sites. (Also be checking the drupal logs after logging in). I would also recommend disabling any modules or features that might be changing the way session information is stored, or implement custom login hooks or redirects. Ideally we'd try a simple test with a vanilla drupal install in your enviornment with just the CAS module enabled.

Sorry this has been so frustrating for you.

dobie_gillis’s picture

I set up a test environment and ran the phpCAS sample code on the server I'm using - I was able to log in, log out, and there was no redirect loop.

It's good to narrow this down -- so now it's looking like this could be coming from the combination of modules I'm using, since I have other Drupal sites on this server working with CAS.

But then again, I have an instance of this site with CAS working on another server, with the same modules enabled. So I'm still puzzled.

dobie_gillis’s picture

Status: Active » Closed (won't fix)

Thanks for the help Dave - I'll mark this as 'wontfix' since it seems to be an issue with either the code or the database of my site. Going to just rebuild the site now.