zl4bv / cakephp-simplesamlphp-plugin Goto Github PK
View Code? Open in Web Editor NEWAdds support for SAML authentication to CakePHP 2.x.
Adds support for SAML authentication to CakePHP 2.x.
Hi,
I want to integrate simpleSAMLphp in my cakephp applicatiob. For this I have read this link: https://github.com/zl4bv/CakePHP-simpleSAMLphp-Plugin, at this link following code is written in Readme file:
Configure::write('Saml.SimpleSamlPath', '/path/to/simpleSAMLphp');
Which path I will give here: '/path/to/simpleSAMLphp'. Is this is the path of simpleSAMLphp application that is installed at separate location or this is the path of cakephp simpleSAMLphp plugin?
I do not want to make a separate simpleSAMLphp application instead this I want to put simpleSAMLphp code in my cakephp application, is this is possible?
My simple requirement is : I want to use simplesamlphp as a Library instead of application. Please suggest me steps to follow for this.
I'm trying to configure SimpleSAMLPHP using CakePHP, in the project using just PHP it works fine but using CakePHP-simpleSAMLphp-Plugin I received the errors when I try to access the view :
Warning (4096): Argument 1 passed to SamlAuthenticate::unauthenticated() must be an instance of Controller, instance of CakeRequest given, called in C:\Users\Alessandro\workspace\RW1\Projetos\Intranet\lib\Cake\Controller\Component\AuthComponent.php on line 348 and defined [APP\Plugin\Saml\Controller\Component\Auth\SamlAuthenticate.php, line 49]
Warning (4096): Argument 1 passed to SamlComponent::login() must be an instance of mixed, none given, called in C:\Users\Alessandro\workspace\RW1\Projetos\Intranet\app\Controller\UsersController.php on line 23 and defined [APP\Plugin\Saml\Controller\Component\SamlComponent.php, line 86]
Notice (8): Undefined variable: url [APP\Plugin\Saml\Controller\Component\SamlComponent.php, line 87]
Warning (4096): Argument 1 passed to SimpleSAML_Auth_Simple::login() must be of the type array, null given, called in C:\Users\Alessandro\workspace\RW1\Projetos\Intranet\app\Plugin\Saml\Controller\Component\SamlComponent.php on line 87 and defined [C:\xampp\simplesaml\lib\SimpleSAML\Auth\Simple.php, line 100]
Warning (2): array_key_exists() expects parameter 2 to be array, null given [C:\xampp\simplesaml\lib\SimpleSAML\Auth\Simple.php, line 102]
Warning (2): array_key_exists() expects parameter 2 to be array, null given [C:\xampp\simplesaml\lib\SimpleSAML\Auth\Simple.php, line 108]
Warning (2): array_key_exists() expects parameter 2 to be array, null given [C:\xampp\simplesaml\lib\SimpleSAML\Auth\Simple.php, line 110]
Warning (2): array_key_exists() expects parameter 2 to be array, null given [C:\xampp\simplesaml\lib\SimpleSAML\Auth\Simple.php, line 120]
Warning (2): Cannot modify header information - headers already sent by (output started at C:\Users\Alessandro\workspace\RW1\Projetos\Intranet\lib\Cake\Utility\Debugger.php:801) [C:\xampp\simplesaml\lib\SimpleSAML\Utilities.php, line 585]
Warning (2): Cannot modify header information - headers already sent by (output started at C:\Users\Alessandro\workspace\RW1\Projetos\Intranet\lib\Cake\Utility\Debugger.php:801) [C:\xampp\simplesaml\lib\SimpleSAML\Utilities.php, line 588]
Warning (2): Cannot modify header information - headers already sent by (output started at C:\Users\Alessandro\workspace\RW1\Projetos\Intranet\lib\Cake\Utility\Debugger.php:801) [C:\xampp\simplesaml\lib\SimpleSAML\Utilities.php, line 589]
Redirect
You were redirected to: https://mysaml:9443/samlsso?...
And after the login I received the return :
SimpleSAML_Error_NoState: NOSTATE
Backtrace:
2 C:\xampp\simplesaml\lib\SimpleSAML\Auth\State.php:225 (SimpleSAML_Auth_State::loadState)
1 C:\xampp\simplesaml\modules\saml\www\sp\saml2-acs.php:63 (require)
0 C:\xampp\simplesaml\www\module.php:134 (N/A)
I'm using CakePHP (2.5.2) and SimpleSAMLPHP (1.13.2)
SamlFormAuthenticate isn't properly loading settings such as userModel
Apparently, SamlFormAuthenticate->_construct lacks a call to parent::__construct($collection, $settings);
Could you please provide an example showing how to add the CakePHP site as a SP on the simpleSAMLphp configuration? I'm struggling with the SingleSignOnService and SingleLogoutService URLs
I configured a SimpleSamlPHP working as a IDP
On the CakePHP site (the SP) I'm using both SimpleSamlPHP and Auth->FormAuthenticate
Thanks in advance
For updating cakePHP 2.10(for PHP7.x support)
This plugin worked for my CakePHP2.4.5 but for CakePHP2.6.0 didn't.
2019-03-12T15:13:17+09:00 ERROR - [InvalidArgumentException] The eventKey variable is required
Stack Trace:
#0 /var/www/html/test/lib/Cake/Controller/Component/AuthComponent.php(818): CakeEventManager->attach(Object(SamlAuthenticate))
#1 /var/www/html/test/lib/Cake/Controller/Component/AuthComponent.php(695): AuthComponent->constructAuthenticate()
#2 /var/www/html/test/lib/Cake/Controller/Component/AuthComponent.php(305): AuthComponent->_getUser()
#3 /var/www/html/test/lib/Cake/Utility/ObjectCollection.php(129): AuthComponent->startup(Object(MainMenuController))
#4 /var/www/html/test/lib/Cake/Event/CakeEventManager.php(243): ObjectCollection->trigger('startup')
#5 /var/www/html/test/lib/Cake/Controller/Controller.php(683): CakeEventManager->dispatch(Object(CakeEvent))
#6 /var/www/html/test/lib/Cake/Routing/Dispatcher.php(189): Controller->startupProcess()
#7 /var/www/html/test/lib/Cake/Routing/Dispatcher.php(167): Dispatcher->_invoke(Object(MainMenuController), Object(CakeRequest))
#8 /var/www/html/test/app/webroot/index.php(117): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
Do support this Plugin (forCakePHP=>2.6.0)?
I would appreciate if you could point out anything to me.
Pardon my broken English.
Is there any extra configuration I am missing? I followed your set up guide on the project homepage.
All pages (except login etc) are denied to guests (using $this->Auth->deny() in app_controller.php). I am using Saml.SamlForm - with both form and SAML authentication allowed. Log in with a form (@ /users/login), and user can access the site, browse pages no problem.
Login with SAML and user is always redirected back to the login page (/users/login). Any links will always redirect back to this page. If I print saml attributes, they are shown, and $this->Saml->isAuthenticated() returns true, but the application always redirects back to the Form login page. Is there more code I am missing so that Cake knows the user is logged in? Do I need to manually initialize a User (accessible from $this->Auth->User()) in the session? If so, what is the best way of achieving this?
I know the saml login is actually working as I can see a token cookie added when login is successful.
Many thanks for any pointers.
Sam
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,
Hi,
do you plan a version of your plugin to cakephp3 ?
I'm new to Cake and simpleSAMLphp. I have simpleSAMLphp running properly because I have it working with WordPress SSO Plugin.
So, I'm trying to figure out why I get this error when I follow your directions. Is the newest version of Cake too new for this plugin?
Error: Call to undefined method SamlAuthenticate::unauthenticated() File: /Users/teammember/Sites/sicake/lib/Cake/Controller/Component/AuthComponent.php Line: 345
We have been tasked with implementing simplesaml login on a cake 3 project. We have been handed a pre-configured simpleSaml folder that if run without cakephp 3 allows the user to login and gain access to a page. We do not have access to the client's azure portal. We tried a custom cakephp 3 implementation, where after login we kept getting redirected to "https://blender.local/simplesaml/module.php/saml/sp/saml2-acs.php/azure-blender-sp".
Please keep in mind that we have next to no experience with saml or federation login in general. At this point we started to explore other options. Converting this plugin to work with cake 3 is an avenue that we decided to explore. I have converted and set up as well as I could. What I am mostly confused about is the simpleSaml work flow, and the server configuration. At the moment we are getting the exact same issue. We require login on an all actions within AppController. The user is redirected to the microsoft login portal. After successful login they are redirected to our site, but end up hitting "https://blender.local/simplesaml/module.php/saml/sp/saml2-acs.php/azure-blender-sp". At which point cake 3 then throws an error "Missing Controller".
In the set up instructions for this plugin I did not see anything in particular about: vhost setup, htaccess or custom actions to allow access to the simplesaml www folder. Since I do not have access to the "azure backend" it is difficult for me to confirm whether the issue lies with: our converted plugin, our cake setup, simpleSaml configuration or server setup.
Am I right in assuming that after login the redirect has to be directed to the simplesaml www directory? If so how did you manage that without cake picking up the navigation and trying to manage it via a controller?
Any advice would be greatly appreciated.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.