From 0ccc25c1f9b4df8d36fffaffe2830842c2ab3170 Mon Sep 17 00:00:00 2001 From: Henrik Ziegenhain Date: Mon, 28 Nov 2016 10:08:50 +0100 Subject: [PATCH] [FEATURE] Allow Basic Auth Protection for SendParametersFinisher Add new Typoscript Settings to use Basic Auth Protection in SendParametersFinisher. If username and password is empty, the target url is called without protection --- Classes/Finisher/SendParametersFinisher.php | 9 +++++++++ .../SendingValuesToThirdPartySoftware/Index.rst | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/Classes/Finisher/SendParametersFinisher.php b/Classes/Finisher/SendParametersFinisher.php index fd5595072..b5ac9b06e 100644 --- a/Classes/Finisher/SendParametersFinisher.php +++ b/Classes/Finisher/SendParametersFinisher.php @@ -92,6 +92,13 @@ public function sendFinisher() curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $curlSettings['params']); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); + /* Set username and password for basic auth - if any*/ + if (!empty($curlSettings['username']) && !empty($curlSettings['password'])) { + $username = $curlSettings['username']; + $password = $curlSettings['password']; + curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY); + curl_setopt($curl, CURLOPT_USERPWD, "$username:$password"); + } curl_exec($curl); curl_close($curl); $this->writeToDevelopmentLog(); @@ -120,6 +127,8 @@ protected function getCurlSettings() { return [ 'url' => $this->configuration['targetUrl'], + 'username' => $this->configuration['username'], + 'password' => $this->configuration['password'], 'params' => $this->getValues() ]; } diff --git a/Documentation/ForAdministrators/BestPractice/SendingValuesToThirdPartySoftware/Index.rst b/Documentation/ForAdministrators/BestPractice/SendingValuesToThirdPartySoftware/Index.rst index 9e9b96a05..65c4fe301 100644 --- a/Documentation/ForAdministrators/BestPractice/SendingValuesToThirdPartySoftware/Index.rst +++ b/Documentation/ForAdministrators/BestPractice/SendingValuesToThirdPartySoftware/Index.rst @@ -27,6 +27,10 @@ See TypoScript Settings example: # Target URL for POST values (like http://www.target.com/target.php) targetUrl = http://eloqua.com/e/f.aspx + # Basic Auth Protection - leave empty if Target is not protected + username = + password = + # build your post values like ¶m1=value1¶m2=value2 values = COA values {