2017 © Pedro Peláez
 

project yii2-simplesamlphp

Integrate simplesamlphp/simplesamlphp into Yii 2 application

image

trandat1001/yii2-simplesamlphp

Integrate simplesamlphp/simplesamlphp into Yii 2 application

  • Tuesday, September 6, 2016
  • by trandat1001
  • Repository
  • 1 Watchers
  • 1 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Yii Simplesamlphp

1. Installation

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)

2. Usage

  • 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)

3. Example

You can install Yii Simplesamlphp Example to try this extension., (*9)

The Versions

06/09 2016

dev-master

9999999-dev http://simplesamlphp.org

Integrate simplesamlphp/simplesamlphp into Yii 2 application

  Sources   Download

LGPL-3.0

The Requires

 

by Dat Tran

yii2 saml2 simplesamlphp idp sp