Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

asasmoyo/yii-simplesamlphp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

// on config/main.php
'components' => array(
	  'simplesamlphp' => array(
          'class' => 'ext.yii-simplesamlphp.components.Simplesamlphp',
          'autoloadPath' => 'SIMPLESAMLPHP_SP_PATH/lib/_autoload.php',
          'authSource' => 'default-sp',
      ),
     
     //your other components
),

###2. Usage

Now you can use the api simply by call Yii::app()->componentName->method_name().

  • Login and logout action

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.

// 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.

###3. Example

You can install Yii Simplesamlphp Example to try this extension.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages