mirror of
https://github.com/elyby/accounts.git
synced 2024-11-15 01:36:12 +05:30
32 lines
889 B
PHP
32 lines
889 B
PHP
<?php
|
|
namespace api\controllers;
|
|
|
|
use api\traits\ApiNormalize;
|
|
use yii\filters\auth\HttpBearerAuth;
|
|
|
|
/**
|
|
* Поведения:
|
|
* @mixin \yii\filters\ContentNegotiator
|
|
* @mixin \yii\filters\VerbFilter
|
|
* @mixin \yii\filters\auth\CompositeAuth
|
|
*/
|
|
class Controller extends \yii\rest\Controller {
|
|
use ApiNormalize;
|
|
|
|
public function behaviors() {
|
|
$parentBehaviors = parent::behaviors();
|
|
// Добавляем авторизатор для входа по jwt токенам
|
|
$parentBehaviors['authenticator'] = [
|
|
'class' => HttpBearerAuth::class,
|
|
];
|
|
|
|
// xml нам не понадобится
|
|
unset($parentBehaviors['contentNegotiator']['formats']['application/xml']);
|
|
// rate limiter здесь не применяется
|
|
unset($parentBehaviors['rateLimiter']);
|
|
|
|
return $parentBehaviors;
|
|
}
|
|
|
|
}
|