XavRsl / Cas

CAS server SSO authentication in Laravel 4.x & 5.x
MIT License
77 stars 36 forks source link

Remove double call to initializeCas #29

Closed loren138 closed 8 years ago

loren138 commented 8 years ago

Because initializeCas() is a part of the constructor, it is guaranteed to have run before the logout function. I use Laravel sessions so I kill the local CAS session immediately after login, but unless the user specifically requests a logout, I don't kill the session at the server. (Thus, I always call logout with no current authenticated user.)

Currently this results in a PHP error:

 phpCAS error: phpCAS::client(): phpCAS::client() has already been called (at /home/vagrant/Code/.../vendor/xavrsl/cas/src/Xavrsl/Cas/Sso.php:76) in /home/vagrant/Code/.../vendor/xavrsl/cas/src/Xavrsl/Cas/Sso.php on line 76

because initializeCas has been called twice and wich calls $this->configureCasClient(); twice which calls phpCAS::client() twice and creates the PHP error.

So if we just remove that if block, everything is happy if the user isn't logged in currently. The if block didn't execute if a user was logged in so it should work in all cases now.

XavRsl commented 8 years ago

Sorry for that VERY late response. I didn't accept the pull request because I already had in mind to change that method anyway.

Thanks for your contribution.

Xavier

loren138 commented 8 years ago

Any thoughts on when you might make those changes?

XavRsl commented 8 years ago

Had to try it first !