skeeks / yii2-http-basic-auth
Http basic auth for Yii2 project
Installs: 9 301
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Type:yii2-extension
Requires
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2024-10-25 10:17:54 UTC
README
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist skeeks/yii2-http-basic-auth "*"
or add
"skeeks/yii2-http-basic-auth": "*"
Configuration app
Exemple 1
'on beforeRequest' => function ($event) { \Yii::$app->httpBasicAuth->verify(); }, 'components' => [ 'httpBasicAuth' => [ 'class' => 'skeeks\yii2\httpBasicAuth\HttpBasicAuthComponent', 'login' => 'login', 'password' => 'password', 'usePasswordHash' => false, //optionality 'viewFail' => '@app/views/http-basic-auth-fail' //optionality ], ]
Exemple 2
'on beforeRequest' => function ($event) { //For example in addition to close the admin panel http authorization if (\Yii::$app->admin->requestIsAdmin) { \Yii::$app->httpBasicAuth->verify(); } }, 'components' => [ 'httpBasicAuth' => [ 'class' => 'skeeks\yii2\httpBasicAuth\HttpBasicAuthComponent', 'login' => 'login', 'password' => 'password', ], ]
SkeekS CMS (Yii2) — quickly, easily and effectively!
skeeks.com | cms.skeeks.com