filsh\yii2\oauth2server\filters\ErrorToExceptionFilter::afterAction PHP Méthode

afterAction() public méthode

public afterAction ( ActionEvent $event ) : boolean
$event ActionEvent
Résultat boolean
    public function afterAction($event)
    {
        $response = Yii::$app->getModule('oauth2')->getServer()->getResponse();
        $optional = $event->action->controller->getBehavior('authenticator')->optional;
        $currentAction = $event->action->id;
        $isValid = true;
        if (!in_array($currentAction, $optional)) {
            if ($response !== null) {
                $isValid = $response->isInformational() || $response->isSuccessful() || $response->isRedirection();
            }
            if (!$isValid) {
                throw new HttpException($response->getStatusCode(), $this->getErrorMessage($response), $response->getParameter('error_uri'));
            }
        }
    }
ErrorToExceptionFilter