• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

phpCAS implementation for a multi-page site

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've followed Jasig's PHP CAS documentation and have successfully implemented their sample code found here (https://github.com/Jasig/phpCAS/blob/master/docs/examples/example_simple.php). This works well for a single page site, but I'm at a loss for how implement this for multiple pages. For example, how do I check if the user is authenticated on subsequent pages after successfully logging in? I thought I would just need to add this code to each of them but what I've found is that though it doesn't redirect me to our CAS signon page again, it does however generate a new unique session cookie for that subsequent page. Essentially, a unique session cookie is generated for each of the pages on my site. If it then try to log out (phpCAS::logout;) from one of these pages, only that page's unique session cookie is invalidated leaving the others active. Essentially I would need to call logout on every page.
 
Matthew Snow
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, I figured it out. It had to do with my CAS config.php settings. At the bottom is the following piece of code



This effectively is what was causing a session cookie to be generated for each page based off of the page's name. Replacing basename($_SERVER['SCRIPT_NAME']) with 'mySite' has solved the issue.
 
Every plan is a little cooler if you have a blimp. And a tiny ad.
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic