-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #172 from razorpay/fixed_csrfValidation_version_bu…
…mp_2.9.1 Fixed issue related with csrf controller not available in Maze < 2.3 for webhook
- Loading branch information
Showing
5 changed files
with
38 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
namespace Razorpay\Magento\Plugin; | ||
class CsrfValidatorSkip | ||
{ | ||
/** | ||
* @param \Magento\Framework\App\Request\CsrfValidator $subject | ||
* @param \Closure $proceed | ||
* @param \Magento\Framework\App\RequestInterface $request | ||
* @param \Magento\Framework\App\ActionInterface $action | ||
*/ | ||
public function aroundValidate( | ||
$subject, | ||
\Closure $proceed, | ||
$request, | ||
$action | ||
) { | ||
if ($request->getModuleName() == 'razorpay') { | ||
//return; // Skip CSRF check | ||
} | ||
$proceed($request, $action); // Proceed Magento 2 core functionalities | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Copyright © 2016 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
|
||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> | ||
<type name="Magento\Framework\App\Request\CsrfValidator"> | ||
<plugin name="csrf_validator_skip" type="Razorpay\Magento\Plugin\CsrfValidatorSkip" /> | ||
</type> | ||
</config> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters