18
18
use Magento \Framework \Encryption \EncryptorInterface ;
19
19
use Magento \Framework \Exception \LocalizedException ;
20
20
use Magento \Framework \UrlInterface ;
21
+ use Magento \Framework \Data \Form \FormKey ;
21
22
22
23
class ImsConfig extends Config
23
24
{
@@ -58,25 +59,33 @@ class ImsConfig extends Config
58
59
*/
59
60
private BackendUrlInterface $ backendUrl ;
60
61
62
+ /**
63
+ * @var FormKey
64
+ */
65
+ private FormKey $ formKey ;
66
+
61
67
/**
62
68
* @param ScopeConfigInterface $scopeConfig
63
69
* @param UrlInterface $url
64
70
* @param WriterInterface $writer
65
71
* @param EncryptorInterface $encryptor
66
72
* @param BackendUrlInterface $backendUrl
73
+ * @param FormKey $formKey
67
74
*/
68
75
public function __construct (
69
76
ScopeConfigInterface $ scopeConfig ,
70
77
UrlInterface $ url ,
71
78
WriterInterface $ writer ,
72
79
EncryptorInterface $ encryptor ,
73
- BackendUrlInterface $ backendUrl
80
+ BackendUrlInterface $ backendUrl ,
81
+ FormKey $ formKey
74
82
) {
75
83
parent ::__construct ($ scopeConfig , $ url );
76
84
$ this ->writer = $ writer ;
77
85
$ this ->encryptor = $ encryptor ;
78
86
$ this ->scopeConfig = $ scopeConfig ;
79
87
$ this ->backendUrl = $ backendUrl ;
88
+ $ this ->formKey = $ formKey ;
80
89
}
81
90
82
91
/**
@@ -180,17 +189,11 @@ public function getProfileUrl(): string
180
189
/**
181
190
* Get Token validation url
182
191
*
183
- * @param string $code
184
- * @param string $tokenType
185
192
* @return string
186
193
*/
187
- public function getValidateTokenUrl (string $ code , string $ tokenType ): string
194
+ public function getValidateTokenUrl (): string
188
195
{
189
- return str_replace (
190
- ['#{token} ' , '#{client_id} ' , '#{token_type} ' ],
191
- [$ code , $ this ->getApiKey (), $ tokenType ],
192
- $ this ->scopeConfig ->getValue (self ::XML_PATH_VALIDATE_TOKEN_URL )
193
- );
196
+ return $ this ->scopeConfig ->getValue (self ::XML_PATH_VALIDATE_TOKEN_URL );
194
197
}
195
198
196
199
/**
@@ -253,11 +256,12 @@ public function getAdminAdobeImsAuthUrl(?string $clientId): string
253
256
}
254
257
255
258
return str_replace (
256
- ['#{client_id} ' , '#{redirect_uri} ' , '#{scope} ' , '#{locale} ' ],
259
+ ['#{client_id} ' , '#{redirect_uri} ' , '#{scope} ' , '#{state} ' , ' #{ locale} ' ],
257
260
[
258
261
$ clientId ,
259
262
$ this ->getAdminAdobeImsCallBackUrl (),
260
263
$ this ->getScopes (),
264
+ $ this ->formKey ->getFormKey (),
261
265
$ this ->getLocale ()
262
266
],
263
267
$ this ->scopeConfig ->getValue (self ::XML_PATH_ADMIN_AUTH_URL_PATTERN )
@@ -272,11 +276,12 @@ public function getAdminAdobeImsAuthUrl(?string $clientId): string
272
276
public function getAdminAdobeImsReAuthUrl (): string
273
277
{
274
278
return str_replace (
275
- ['#{client_id} ' , '#{redirect_uri} ' , '#{scope} ' , '#{locale} ' ],
279
+ ['#{client_id} ' , '#{redirect_uri} ' , '#{scope} ' , '#{state} ' , ' #{ locale} ' ],
276
280
[
277
281
$ this ->getApiKey (),
278
282
$ this ->getAdminAdobeImsReAuthCallBackUrl (),
279
283
$ this ->getScopes (),
284
+ $ this ->formKey ->getFormKey (),
280
285
$ this ->getLocale ()
281
286
],
282
287
$ this ->scopeConfig ->getValue (self ::XML_PATH_ADMIN_REAUTH_URL_PATTERN )
@@ -345,16 +350,11 @@ private function getLocale(): string
345
350
/**
346
351
* Get BackendLogout URL
347
352
*
348
- * @param string $accessToken
349
353
* @return string
350
354
*/
351
- public function getBackendLogoutUrl (string $ accessToken ) : string
355
+ public function getBackendLogoutUrl () : string
352
356
{
353
- return str_replace (
354
- ['#{access_token} ' , '#{client_secret} ' , '#{client_id} ' ],
355
- [$ accessToken , $ this ->getPrivateKey (), $ this ->getApiKey ()],
356
- $ this ->scopeConfig ->getValue (self ::XML_PATH_ADMIN_LOGOUT_URL )
357
- );
357
+ return $ this ->scopeConfig ->getValue (self ::XML_PATH_ADMIN_LOGOUT_URL );
358
358
}
359
359
360
360
/**
0 commit comments