Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Request.php
Go to the documentation of this file.
1 <?php
8 
13 
14 class Request extends Action implements CsrfAwareActionInterface
15 {
19  protected $oauthService;
20 
24  protected $helper;
25 
31  public function __construct(
32  \Magento\Framework\App\Action\Context $context,
33  \Magento\Framework\Oauth\OauthInterface $oauthService,
34  \Magento\Framework\Oauth\Helper\Request $helper
35  ) {
36  parent::__construct($context);
37  $this->oauthService = $oauthService;
38  $this->helper = $helper;
39  }
40 
47  return null;
48  }
49 
53  public function validateForCsrf(RequestInterface $request): ?bool
54  {
55  return true;
56  }
57 
63  public function execute()
64  {
65  try {
66  $requestUrl = $this->helper->getRequestUrl($this->getRequest());
67  $request = $this->helper->prepareRequest($this->getRequest(), $requestUrl);
68 
69  // Request request token
70  $response = $this->oauthService->getRequestToken($request, $requestUrl, $this->getRequest()->getMethod());
71  } catch (\Exception $exception) {
72  $response = $this->helper->prepareErrorResponse($exception, $this->getResponse());
73  }
74  $this->getResponse()->setBody(http_build_query($response));
75  }
76 }
__construct(\Magento\Framework\App\Action\Context $context, \Magento\Framework\Oauth\OauthInterface $oauthService, \Magento\Framework\Oauth\Helper\Request $helper)
Definition: Request.php:31
$response
Definition: 404.php:11
validateForCsrf(RequestInterface $request)
Definition: Request.php:53
createCsrfValidationException(RequestInterface $request)
Definition: Request.php:44