Skip to content

Commit 93069c1

Browse files
committed
Allow forwarding to noroute admin route
1 parent cd826aa commit 93069c1

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

lib/internal/Magento/Framework/App/Action/Forward.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@
77
*/
88
namespace Magento\Framework\App\Action;
99

10+
use Magento\Framework\App\CsrfAwareActionInterface;
1011
use Magento\Framework\App\RequestInterface;
12+
use Magento\Framework\App\Request\InvalidRequestException;
1113
use Magento\Framework\App\ResponseInterface;
1214

1315
/**
1416
* Forward request further.
1517
*
1618
* @SuppressWarnings(PHPMD.AllPurposeAction)
1719
*/
18-
class Forward extends AbstractAction
20+
class Forward extends AbstractAction implements CsrfAwareActionInterface
1921
{
2022
/**
2123
* @param RequestInterface $request
@@ -35,4 +37,21 @@ public function execute()
3537
$this->_request->setDispatched(false);
3638
return $this->_response;
3739
}
40+
41+
/**
42+
* @inheritDoc
43+
*/
44+
public function createCsrfValidationException(RequestInterface $request): ?InvalidRequestException
45+
{
46+
return new InvalidRequestException($this->_response);
47+
}
48+
49+
/**
50+
* @inheritDoc
51+
*/
52+
public function validateForCsrf(RequestInterface $request): ?bool
53+
{
54+
// This exists so that we can forward to the noroute action in the admin
55+
return true;
56+
}
3857
}

0 commit comments

Comments
 (0)