Completed
Push — master ( 5d8f1a...6c6657 )
by zacksleo
01:34
created

Oauth2Controller::behaviors()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 0
1
<?php
2
3
namespace zacksleo\yii2\oauth2\api\components;
4
5
use yii\helpers\ArrayHelper;
6
use yii\filters\auth\HttpBearerAuth;
7
use yii\filters\auth\QueryParamAuth;
8
use filsh\yii2\oauth2server\filters\auth\CompositeAuth;
9
10
/**
11
 * Class AuthController
12
 */
13
class Oauth2Controller extends RestController
14
{
15
    /**
16
     * @inheritdoc
17
     */
18
    public function behaviors()
19
    {
20
        return ArrayHelper::merge(parent::behaviors(), [
21
            'authenticator' => [
22
                'class' => CompositeAuth::className(),
23
                'authMethods' => [
24
                    ['class' => HttpBearerAuth::className()],
25
                    ['class' => QueryParamAuth::className(), 'tokenParam' => 'access_token'],
26
                ]
27
            ],
28
        ]);
29
    }
30
}
31