2017 © Pedro Peláez
 

yii2-extension yii2-cas-client

CAS authentication for Yii2

image

poofe/yii2-cas-client

CAS authentication for Yii2

  • Wednesday, July 25, 2018
  • by Jonas-Huang
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

yii2-auth-cas

Yii2 library for authentication by CAS, using the library phpCAS., (*1)

Usage

  1. Add this to the project with composer require poofe/yii2casclient, (*2)

  2. Configure the Yii2 application, e.g. in backend/config/main.php :, (*3)

    return [
        ...
        'session' => [
            'class' => 'poofe\yii2casclient\cas\Session',
            ...
        ],
        'modules' => [
            'cas' => [
                'class' => 'poofe\yii2casclient\cas\CasModule',
                'config' => [
                    'host' => 'ssoserver.example.com',
                    'port' => '443',
                    'path' => '/idp/profile/cas',
                    // optional parameters
                    'certfile' => false, // empty, or path to a SSL cert, or false to ignore certs
                    'debug' => true, // will add many logs into X/runtime/logs/cas.log
                ],
            ],
    
  3. Add actions that use this CAS module, e.g. in SiteController :, (*4)

    public function actionLogin()
    {
        if (!Yii::$app->user->isGuest) {
            return $this->goHome();
        }
        return $this->redirect(['/cas/auth/login']);
    }
    
    public function actionLogout()
    {
        if (Yii::$app->user->isGuest) {
            return $this->redirect(['/cas/auth/logout']);
        }
        return $this->goHome();
    }
    

Notes

The user component that implements yii\web\IdentityInterface will be used to fetch the local profile after querying the CAS server. It means that if User is the App component and CAS returns a username of "bibendum", the authentication will be successful if and only if the result of User::findIdentity("bibendum") is not null., (*5)

The action path '/cas/auth/login' starts with the alias of the module, as defined in the application configuration, e.g. 'cas' in 'modules' => [ 'cas' => [ ... ] ]., (*6)

The Versions

25/07 2018

dev-master

9999999-dev

CAS authentication for Yii2

  Sources   Download

MIT

The Requires

 

by poofe Huang

authentication yii2 yii cas

25/07 2018

1.0.0

1.0.0.0

CAS authentication for Yii2

  Sources   Download

MIT

The Requires

 

by poofe Huang

authentication yii2 yii cas