zl4bv / CakePHP-simpleSAMLphp-Plugin

Adds support for SAML authentication to CakePHP 2.x.
12 stars 8 forks source link

Question: What is the most efficient setup for SimpleSamlPHP? #2

Closed scith closed 10 years ago

scith commented 10 years ago

Hello, I was just wondering how you setup your own SimpleSamlPHP for it to work smoothly with CakePHP please? I tried a standard setup but the SimpleSamlPHP sessions conflict with CakePHP sessions. I only managed to make it work by storing SimpleSamlPHP sessions in SQL but I'd prefer to use sessions.

Also it could be nice to have an "invisible" integration with Auth. Like being able to use $this->Auth->login() or logout() to do these actions both in SimpleSamlPHP and Auth. I did this on logout in my fork.

Thanks,

zl4bv commented 10 years ago

Hi scith,

Sorry for the delay. If I recall correctly, I'm storing SimpleSAML's sessions in SQL. Are you able to set different names for the session cookies? I think I had an issue around that.

I will look into adding "invisible" integration with Auth. It was something I wanted to do from the start, but not urgent enough to figure out how to do it neatly.

There were a few changes to Auth in CakePHP 2.4 that I need to investigate before making changes to my existing code. If you manage to get it working before I do then you're welcome to send me a pull request.

Cheers, Ben

scith commented 10 years ago

Hello, thanks for your reply :) I'm using SQL too because I have the same issue... I found a way to do a double authentication, I will send you a pull soon (because I did too much customisation on my auth so I have to make it more simple before I send you a pull).

Basically, I created a new Authenticate file which extends FormAuthenticate and in the public function authenticate I populate the session token with either SAML info (with if(isAuthenticated()) and getAttributes) or with the info sent in the form. And then I return the token and redirect to the previous page.

I'll post this maybe this weekend.

Cheers Jeff

zl4bv commented 10 years ago

With your recent code changes (#3), I will consider this closed :)