/**
  * @return ApproveControl
  * @throws AbortException
  * @throws BadRequestException
  */
 protected function createComponentApprove() : ApproveControl
 {
     if (!$this->getUser()->isLoggedIn()) {
         $this->redirect(...$this->redirectConfig->getLoginDestination());
     }
     /** @var string $data */
     $data = $this->getSession(OAuth2Presenter::SESSION_NAMESPACE)->authorizationRequest;
     $authorizationRequest = $data ? $this->authorizationRequestSerializer->unserialize($data) : null;
     if ($authorizationRequest) {
         if (!$authorizationRequest->getUser()) {
             $authorizationRequest->setUser(new UserEntity($this->getUser()->getId()));
         }
         $control = $this->approveControlFactory->create($authorizationRequest);
         $control->onResponse[] = function (ApplicationPsr7ResponseInterface $response) {
             $this->sendResponse($response);
         };
         return $control;
     }
     $this->error(null, HttpResponse::S400_BAD_REQUEST);
 }