Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/skeeks-semenov/yii2-http-basic-auth
Http basic auth for Yii2 project
https://github.com/skeeks-semenov/yii2-http-basic-auth
auth skeeks skeeks-cms yii yii2 yii2-auth yii2-extension
Last synced: 24 days ago
JSON representation
Http basic auth for Yii2 project
- Host: GitHub
- URL: https://github.com/skeeks-semenov/yii2-http-basic-auth
- Owner: skeeks-semenov
- License: bsd-3-clause
- Created: 2016-04-17T17:44:59.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-01-24T21:19:00.000Z (almost 6 years ago)
- Last Synced: 2024-09-29T23:01:28.864Z (about 1 month ago)
- Topics: auth, skeeks, skeeks-cms, yii, yii2, yii2-auth, yii2-extension
- Language: PHP
- Homepage: https://skeeks.com
- Size: 21.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Http basic auth for Yii2 project
===================================[![Latest Stable Version](https://img.shields.io/packagist/v/skeeks/yii2-http-basic-auth.svg)](https://packagist.org/packages/skeeks/yii2-http-basic-auth)
[![Total Downloads](https://img.shields.io/packagist/dt/skeeks/yii2-http-basic-auth.svg)](https://packagist.org/packages/skeeks/yii2-http-basic-auth)Installation
------------The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
Either run
```
php composer.phar require --prefer-dist skeeks/yii2-http-basic-auth "*"
```or add
```
"skeeks/yii2-http-basic-auth": "*"
```Configuration app
----------
Exemple 1
---------```php
'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
---------```php
'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!](https://skeeks.com/img/logo/logo-no-title-80px.png)](https://skeeks.com)
SkeekS CMS (Yii2) — quickly, easily and effectively!
[skeeks.com](https://skeeks.com) | [cms.skeeks.com](https://cms.skeeks.com)