Skip to content

Commit 5f932f2

Browse files
author
okarpenko
committed
MAGETWO-37815: Unable to revoke All Access Tokens for Customer without Tokens
1 parent 086f3b9 commit 5f932f2

File tree

2 files changed

+110
-10
lines changed

2 files changed

+110
-10
lines changed

app/code/Magento/Customer/Controller/Adminhtml/Customer/InvalidateToken.php

Lines changed: 109 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,119 @@
77

88
namespace Magento\Customer\Controller\Adminhtml\Customer;
99

10+
use Magento\Integration\Api\CustomerTokenServiceInterface;
11+
use Magento\Customer\Api\AccountManagementInterface;
12+
use Magento\Customer\Api\AddressRepositoryInterface;
13+
use Magento\Customer\Api\CustomerRepositoryInterface;
14+
use Magento\Customer\Api\Data\AddressInterfaceFactory;
15+
use Magento\Customer\Api\Data\CustomerInterfaceFactory;
16+
use Magento\Customer\Model\Address\Mapper;
17+
use Magento\Framework\ObjectFactory;
18+
use Magento\Framework\Api\DataObjectHelper;
19+
1020
/**
11-
* Class to invalidate tokens for customers
21+
* Class to invalidate tokens for customers
22+
*
23+
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
24+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
25+
* @SuppressWarnings(PHPMD.TooManyFields)
26+
* @SuppressWarnings(PHPMD.NumberOfChildren)
1227
*/
1328
class InvalidateToken extends \Magento\Customer\Controller\Adminhtml\Index
1429
{
30+
/**
31+
* @var CustomerTokenServiceInterface
32+
*/
33+
protected $tokenService;
34+
35+
/**
36+
* @param CustomerTokenServiceInterface $tokenService
37+
* @param \Magento\Backend\App\Action\Context $context
38+
* @param \Magento\Framework\Registry $coreRegistry
39+
* @param \Magento\Framework\App\Response\Http\FileFactory $fileFactory
40+
* @param \Magento\Customer\Model\CustomerFactory $customerFactory
41+
* @param \Magento\Customer\Model\AddressFactory $addressFactory
42+
* @param \Magento\Customer\Model\Metadata\FormFactory $formFactory
43+
* @param \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory
44+
* @param \Magento\Customer\Helper\View $viewHelper
45+
* @param \Magento\Framework\Math\Random $random
46+
* @param CustomerRepositoryInterface $customerRepository
47+
* @param \Magento\Framework\Api\ExtensibleDataObjectConverter $extensibleDataObjectConverter
48+
* @param Mapper $addressMapper
49+
* @param AccountManagementInterface $customerAccountManagement
50+
* @param AddressRepositoryInterface $addressRepository
51+
* @param CustomerInterfaceFactory $customerDataFactory
52+
* @param AddressInterfaceFactory $addressDataFactory
53+
* @param \Magento\Customer\Model\Customer\Mapper $customerMapper
54+
* @param \Magento\Framework\Reflection\DataObjectProcessor $dataObjectProcessor
55+
* @param DataObjectHelper $dataObjectHelper
56+
* @param ObjectFactory $objectFactory
57+
* @param \Magento\Framework\View\LayoutFactory $layoutFactory
58+
* @param \Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory
59+
* @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
60+
* @param \Magento\Backend\Model\View\Result\ForwardFactory $resultForwardFactory
61+
* @param \Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
62+
*
63+
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
64+
*/
65+
public function __construct(
66+
\Magento\Backend\App\Action\Context $context,
67+
\Magento\Framework\Registry $coreRegistry,
68+
\Magento\Framework\App\Response\Http\FileFactory $fileFactory,
69+
\Magento\Customer\Model\CustomerFactory $customerFactory,
70+
\Magento\Customer\Model\AddressFactory $addressFactory,
71+
\Magento\Customer\Model\Metadata\FormFactory $formFactory,
72+
\Magento\Newsletter\Model\SubscriberFactory $subscriberFactory,
73+
\Magento\Customer\Helper\View $viewHelper,
74+
\Magento\Framework\Math\Random $random,
75+
CustomerRepositoryInterface $customerRepository,
76+
\Magento\Framework\Api\ExtensibleDataObjectConverter $extensibleDataObjectConverter,
77+
Mapper $addressMapper,
78+
AccountManagementInterface $customerAccountManagement,
79+
AddressRepositoryInterface $addressRepository,
80+
CustomerInterfaceFactory $customerDataFactory,
81+
AddressInterfaceFactory $addressDataFactory,
82+
\Magento\Customer\Model\Customer\Mapper $customerMapper,
83+
\Magento\Framework\Reflection\DataObjectProcessor $dataObjectProcessor,
84+
DataObjectHelper $dataObjectHelper,
85+
ObjectFactory $objectFactory,
86+
\Magento\Framework\View\LayoutFactory $layoutFactory,
87+
\Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory,
88+
\Magento\Framework\View\Result\PageFactory $resultPageFactory,
89+
\Magento\Backend\Model\View\Result\ForwardFactory $resultForwardFactory,
90+
\Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory,
91+
CustomerTokenServiceInterface $tokenService
92+
) {
93+
$this->tokenService = $tokenService;
94+
parent::__construct(
95+
$context,
96+
$coreRegistry,
97+
$fileFactory,
98+
$customerFactory,
99+
$addressFactory,
100+
$formFactory,
101+
$subscriberFactory,
102+
$viewHelper,
103+
$random,
104+
$customerRepository,
105+
$extensibleDataObjectConverter,
106+
$addressMapper,
107+
$customerAccountManagement,
108+
$addressRepository,
109+
$customerDataFactory,
110+
$addressDataFactory,
111+
$customerMapper,
112+
$dataObjectProcessor,
113+
$dataObjectHelper,
114+
$objectFactory,
115+
$layoutFactory,
116+
$resultLayoutFactory,
117+
$resultPageFactory,
118+
$resultForwardFactory,
119+
$resultJsonFactory
120+
);
121+
}
122+
15123
/**
16124
* Reset customer's tokens handler
17125
*

app/code/Magento/Customer/Controller/Adminhtml/Index.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use Magento\Framework\Message\Error;
1616
use Magento\Framework\ObjectFactory;
1717
use Magento\Framework\Api\DataObjectHelper;
18-
use Magento\Integration\Api\CustomerTokenServiceInterface;
1918

2019
/**
2120
* Class Index
@@ -144,11 +143,6 @@ class Index extends \Magento\Backend\App\Action
144143
*/
145144
protected $resultJsonFactory;
146145

147-
/**
148-
* @var CustomerTokenServiceInterface
149-
*/
150-
protected $tokenService;
151-
152146
/**
153147
* @param \Magento\Backend\App\Action\Context $context
154148
* @param \Magento\Framework\Registry $coreRegistry
@@ -203,8 +197,7 @@ public function __construct(
203197
\Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory,
204198
\Magento\Framework\View\Result\PageFactory $resultPageFactory,
205199
\Magento\Backend\Model\View\Result\ForwardFactory $resultForwardFactory,
206-
\Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory,
207-
CustomerTokenServiceInterface $tokenService
200+
\Magento\Framework\Controller\Result\JsonFactory $resultJsonFactory
208201
) {
209202
$this->_coreRegistry = $coreRegistry;
210203
$this->_fileFactory = $fileFactory;
@@ -230,7 +223,6 @@ public function __construct(
230223
$this->resultPageFactory = $resultPageFactory;
231224
$this->resultForwardFactory = $resultForwardFactory;
232225
$this->resultJsonFactory = $resultJsonFactory;
233-
$this->tokenService = $tokenService;
234226
parent::__construct($context);
235227
}
236228

0 commit comments

Comments
 (0)