Skip to content

Commit 28ab36f

Browse files
committed
Modify PostController to use params behaviors
1 parent 8ddff2e commit 28ab36f

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

modules/v1/controllers/PostController.php

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,13 @@
22

33
namespace app\modules\v1\controllers;
44

5-
use yii\filters\auth\CompositeAuth;
6-
use yii\filters\auth\HttpBasicAuth;
7-
use yii\filters\auth\HttpBearerAuth;
8-
use yii\filters\auth\QueryParamAuth;
5+
use app\helpers\BehaviorsFromParamsHelper;
96
use yii\rest\ActiveController;
107

118
/*
12-
* Created on Thu Feb 22 2018
13-
* By Heru Arief Wijaya
14-
* Copyright (c) 2018 belajararief.com
9+
*
10+
* @author Heru Arief Wijaya
11+
* 2020 @ belajararief.com
1512
*/
1613

1714
class PostController extends ActiveController
@@ -21,14 +18,7 @@ class PostController extends ActiveController
2118
public function behaviors()
2219
{
2320
$behaviors = parent::behaviors();
24-
$behaviors['authenticator'] = [
25-
'class' => CompositeAuth::className(),
26-
'authMethods' => [
27-
HttpBasicAuth::className(),
28-
HttpBearerAuth::className(),
29-
QueryParamAuth::className(),
30-
],
31-
];
21+
$behaviors = BehaviorsFromParamsHelper::behaviors($behaviors);
3222
return $behaviors;
3323
}
3424
}

0 commit comments

Comments
 (0)