Exemplo n.º 1
0
 /**
  * Store handler.
  *
  * @return \Illuminate\Http\Response
  */
 public function store()
 {
     return $this->withErrorHandling(function () use($request) {
         $authRequest = $this->getAuthRequestFromSession($request);
         return $this->server->completeAuthorizationRequest($authRequest, new Psr7Response());
     });
 }
 private function completeAuthorizationRequest()
 {
     $this->session->getSection(OAuth2Presenter::SESSION_NAMESPACE)->remove();
     $response = $this->createResponse();
     try {
         $this->onResponse($this->authorizationServer->completeAuthorizationRequest($this->authorizationRequest, $response));
     } catch (AbortException $e) {
         throw $e;
     } catch (OAuthServerException $e) {
         $this->onResponse($e->generateHttpResponse($response));
     } catch (\Exception $e) {
         if ($this->logger) {
             $this->logger->error($e->getMessage(), ['exception' => $e]);
         }
         $body = $this->createStream();
         $body->write('Unknown error');
         $this->onResponse($response->withStatus(HttpResponse::S500_INTERNAL_SERVER_ERROR)->withBody($body));
     }
 }