dev-master
9999999-dev http://simplesamlphp.orgIntegrate simplesamlphp/simplesamlphp into Yii 2 application
LGPL-3.0
The Requires
- php >=5.3
- simplesamlphp/simplesamlphp *
by Dat Tran
yii2 saml2 simplesamlphp idp sp
Wallogit.com
2017 © Pedro Peláez
Integrate simplesamlphp/simplesamlphp into Yii 2 application
Download or clone this repot then extract to extensions. Register components/Simplesaml.php as a component. It needs 2 arguments, autoloadPath where your simplesamlphp sp's lib/_autoload.php is and authSource the authentication source that you will use on your config/authsources.php, (*1)
```php // on config/main.php 'components' => array( 'simplesamlphp' => array( 'class' => 'ext.yii-simplesamlphp.components.Simplesamlphp', 'autoloadPath' => 'SIMPLESAMLPHP_SP_PATH/lib/_autoload.php', 'authSource' => 'default-sp', ),, (*2)
//your other components
), ```, (*3)
Using simplesamlphp sp's api, (*4)
Now you can use the api simply by call Yii::app()->componentName->method_name()., (*5)
Login and logout action, (*6)
You can use our LoginAction and LogoutAction to login and logout your application with Simplesamlphp. All you need to do is create method actions on your controller and add LoginAction and LogoutAction., (*7)
// on your controller
class SiteController extends Controller {
public function actions() {
return array(
'login' => array(
'class' => 'ext.yii-simplesamlphp.actions.LoginAction',
'simplesamlphpComponentName' => 'simplesamlphp',
'redirectAfterLoginTo' => array('/'),
),
'logout' => array(
'class' => 'ext.yii-simplesamlphp.actions.LogoutAction',
'simplesamlphpComponentName' => 'simplesamlphp',
'redirectAfterLogoutTo' => array('/'),
),
);
}
//your other actions
}
Now you can login via site/login and logout via site/logout.
You need to specify simplesamlphpComponentName with your component name which you register components/Simplesamlphp.php and redirectAfterLogin and redirectAfterLogout with a route where you want to be redirected after login / logout., (*8)
You can install Yii Simplesamlphp Example to try this extension., (*9)
Integrate simplesamlphp/simplesamlphp into Yii 2 application
LGPL-3.0
yii2 saml2 simplesamlphp idp sp