• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

phpCAS implementation for a multi-page site

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
Dinner will be steamed monkey heads with a side of tiny ads.
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic