dmsylvio / sso
Connect Yii 2 application to a Identity Provider for Single Sign On
Installs: 50
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- yiisoft/yii2: ~2.0.0
This package is auto-updated.
Last update: 2025-05-12 06:06:01 UTC
README
Connect Yii 2 application to a Identity Provider for Single Sign On
Installation
The preferred way to install this extension is through composer.
Either run
composer require --prefer-dist dmsylvio/sso "dev-master"
or add
"dmsylvio/sso": "dev-master"
to the require section of your composer.json
file.
Database Migration
Check your database settings and run migration from your console:
php yii migrate --migrationPath=@vendor/dmsylvio/sso/migrations
For more informations see Database Migration Documentation
Configuration
To access the module, you need to add this to your application configuration:
......
'modules' => [
'sso' => [
'class' => 'app\vendor\dmsylvio\sso\Access',
],
],
......
Configure System Id in config/params.php
return [
'adminEmail' => 'admin@example.com',
'systemId' => '2',
'systemName' => 'teste',
'systemDesc' => 'Sistema de teste',
];
Add the new menu item to your navbar: [not necessary] ~ only to verify that sso is installed
......
['label' => 'sso', 'url' => ['/sso']],
......
You may have to customize the user rights for the access log view. You could do it by editing ```behaviors/AccessRule.php```.
Example manual usage
This is an example in the login method from the module dmsylvio/yii2-accounts.
use app\vendor\dmsylvio\sso\behaviors\AccessRule;
......
/**
* {@inheritdoc}
*/
public function behaviors(){
$controllername = Yii::$app->controller->id;
$behaviors = [
'access' => [
'class' => AccessControl::class,
'ruleConfig' => [
'class' => AccessRule::class,
],
'only' => AccessRule::getActions($controllername),
'rules' => AccessRule::getRoles($controllername),
],
'verbs' => [
'class' => VerbFilter::class,
'actions' => [
'delete' => ['post'],
],
],
];
return $behaviors;
}
......