1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace rhertogh\Yii2Oauth2Server\controllers\web\consent; |
4
|
|
|
|
5
|
|
|
use rhertogh\Yii2Oauth2Server\controllers\web\base\Oauth2BaseWebAction; |
6
|
|
|
use rhertogh\Yii2Oauth2Server\controllers\web\Oauth2ConsentController; |
7
|
|
|
use rhertogh\Yii2Oauth2Server\exceptions\Oauth2ServerHttpException; |
|
|
|
|
8
|
|
|
use rhertogh\Yii2Oauth2Server\interfaces\controllers\web\consent\Oauth2AuthorizeEndSessionActionInterface; |
9
|
|
|
use Yii; |
10
|
|
|
use yii\base\InvalidConfigException; |
11
|
|
|
use yii\web\BadRequestHttpException; |
12
|
|
|
use yii\web\HttpException; |
13
|
|
|
use yii\web\ServerErrorHttpException; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* @property Oauth2ConsentController $controller |
17
|
|
|
*/ |
18
|
|
|
class Oauth2AuthorizeEndSessionAction extends Oauth2BaseWebAction implements Oauth2AuthorizeEndSessionActionInterface |
19
|
|
|
{ |
20
|
|
|
/** |
21
|
|
|
* Path to view file for End Session authorization. |
22
|
|
|
* @var string|null |
23
|
|
|
*/ |
24
|
|
|
public $openIdConnectLogoutConfirmationView = null; |
25
|
|
|
|
26
|
|
|
public function init() |
27
|
|
|
{ |
28
|
|
|
parent::init(); |
29
|
|
|
if (empty($this->openIdConnectLogoutConfirmationView)) { |
30
|
|
|
throw new InvalidConfigException('$openIdConnectLogoutConfirmationView must be set.'); |
31
|
|
|
} |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public function run($endSessionAuthorizationRequestId) |
35
|
|
|
{ |
36
|
|
|
try { |
37
|
|
|
$module = $this->controller->module; |
38
|
|
|
|
39
|
|
|
$endSessionAuthorizationRequest = $module->getEndSessionAuthReqSession($endSessionAuthorizationRequestId); |
40
|
|
|
|
41
|
|
|
if (empty($endSessionAuthorizationRequest)) { |
42
|
|
|
throw new BadRequestHttpException(Yii::t('oauth2', 'Invalid endSessionAuthorizationRequestId.')); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
if ( |
46
|
|
|
$endSessionAuthorizationRequest->load(Yii::$app->request->post()) |
|
|
|
|
47
|
|
|
&& $endSessionAuthorizationRequest->validate() |
48
|
|
|
) { |
49
|
|
|
return $module->generateEndSessionAuthReqCompledRedirectResponse($endSessionAuthorizationRequest); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
return $this->controller->render($this->openIdConnectLogoutConfirmationView, [ |
53
|
|
|
'endSessionAuthorizationRequest' => $endSessionAuthorizationRequest, |
54
|
|
|
]); |
55
|
|
|
} catch (\Exception $e) { |
56
|
|
|
$message = Yii::t('oauth2', 'Unable to respond to logout authorization request.'); |
57
|
|
|
if ($e instanceof HttpException) { |
58
|
|
|
$message .= ' ' . $e->getMessage(); |
59
|
|
|
} |
60
|
|
|
throw new ServerErrorHttpException($message, 0, $e); |
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths