|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace rhertogh\Yii2Oauth2Server\controllers\web; |
|
4
|
|
|
|
|
5
|
|
|
use rhertogh\Yii2Oauth2Server\controllers\web\base\Oauth2BaseApiController; |
|
6
|
|
|
use rhertogh\Yii2Oauth2Server\filters\auth\Oauth2HttpBearerAuth; |
|
7
|
|
|
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\Oauth2OidcControllerInterface; |
|
8
|
|
|
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\openidconnect\Oauth2OidcEndSessionActionInterface; |
|
9
|
|
|
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\openidconnect\Oauth2OidcUserinfoActionInterface; |
|
10
|
|
|
use yii\filters\AccessControl; |
|
11
|
|
|
use yii\filters\VerbFilter; |
|
12
|
|
|
use yii\helpers\ArrayHelper; |
|
13
|
|
|
|
|
14
|
|
|
class Oauth2OidcController extends Oauth2BaseApiController implements Oauth2OidcControllerInterface |
|
15
|
|
|
{ |
|
16
|
|
|
/** |
|
17
|
|
|
* @inheritDoc |
|
18
|
|
|
*/ |
|
19
|
3 |
|
public function behaviors() |
|
20
|
|
|
{ |
|
21
|
3 |
|
return ArrayHelper::merge(parent::behaviors(), [ |
|
22
|
3 |
|
'verbFilter' => [ |
|
23
|
3 |
|
'class' => VerbFilter::class, |
|
24
|
3 |
|
'actions' => [ |
|
25
|
3 |
|
static::ACTION_NAME_USERINFO => ['GET', 'POST'], |
|
26
|
3 |
|
static::ACTION_END_SESSION => ['GET', 'POST'], |
|
27
|
3 |
|
], |
|
28
|
3 |
|
], |
|
29
|
3 |
|
'authenticator' => [ |
|
30
|
3 |
|
'class' => Oauth2HttpBearerAuth::class, |
|
31
|
3 |
|
'except' => [ |
|
32
|
3 |
|
static::ACTION_END_SESSION, |
|
33
|
3 |
|
], |
|
34
|
3 |
|
], |
|
35
|
3 |
|
'accessControl' => [ |
|
36
|
3 |
|
'class' => AccessControl::class, |
|
37
|
3 |
|
'rules' => [ |
|
38
|
3 |
|
[ |
|
39
|
3 |
|
'allow' => true, |
|
40
|
3 |
|
'roles' => ['@'], |
|
41
|
3 |
|
], |
|
42
|
3 |
|
], |
|
43
|
3 |
|
'except' => [ |
|
44
|
3 |
|
static::ACTION_END_SESSION, |
|
45
|
3 |
|
], |
|
46
|
3 |
|
], |
|
47
|
3 |
|
]); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* @inheritDoc |
|
52
|
|
|
*/ |
|
53
|
3 |
|
public function actions() |
|
54
|
|
|
{ |
|
55
|
3 |
|
return [ |
|
56
|
3 |
|
static::ACTION_NAME_USERINFO => Oauth2OidcUserinfoActionInterface::class, |
|
57
|
3 |
|
static::ACTION_END_SESSION => Oauth2OidcEndSessionActionInterface::class, |
|
58
|
3 |
|
]; |
|
59
|
|
|
} |
|
60
|
|
|
} |
|
61
|
|
|
|