| 1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- namespace backendApi\modules\v1;
- /**
- * Created by PhpStorm.
- * User: leo
- * Date: 2018/2/24
- * Time: 上午11:41
- */
- class Module extends \yii\base\Module
- {
- public $controllerNamespace = 'backendApi\modules\v1\controllers';
- public function init()
- {
- parent::init();
- \Yii::$app->user->enableSession = false;
- }
- public function behaviors()
- {
- $behaviors = parent::behaviors();
- $module = $this->id;
- $controller = $this->module->controller->id;
- $action = $this->module->controller->action->id;
- $noCheckActions = \Yii::$app->params['noCheckTokenActions'];
- if(!in_array($module.'/'.$controller.'/'.$action, $noCheckActions)){
- $behaviors['authenticator'] = [
- 'class' => 'yii\filters\auth\CompositeAuth',
- 'authMethods' => [
- 'yii\filters\auth\HttpBasicAuth',
- 'yii\filters\auth\HttpBearerAuth',
- 'yii\filters\auth\QueryParamAuth',
- ],
- ];
- }
- return $behaviors;
- }
- }
|