Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15390042
D8621.id20464.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D8621.id20464.diff
View Options
diff --git a/src/conduit/ConduitClient.php b/src/conduit/ConduitClient.php
--- a/src/conduit/ConduitClient.php
+++ b/src/conduit/ConduitClient.php
@@ -9,7 +9,8 @@
private $connectionID;
private $sessionKey;
private $timeout = 300.0;
- private $basicAuthCredentials;
+ private $username;
+ private $password;
public function getConnectionID() {
return $this->connectionID;
@@ -83,10 +84,11 @@
$core_future->setMethod('POST');
$core_future->setTimeout($this->timeout);
- if ($this->basicAuthCredentials !== null) {
- $core_future->addHeader(
- 'Authorization',
- 'Basic '.$this->basicAuthCredentials);
+
+ if ($this->username !== null) {
+ $core_future->setHTTPBasicAuthCredentials(
+ $this->username,
+ $this->password);
}
$conduit_future = new ConduitFuture($core_future);
@@ -98,7 +100,8 @@
}
public function setBasicAuthCredentials($username, $password) {
- $this->basicAuthCredentials = base64_encode($username.':'.$password);
+ $this->username = $username;
+ $this->password = new PhutilOpaqueEnvelope($password);
return $this;
}
diff --git a/src/future/http/BaseHTTPFuture.php b/src/future/http/BaseHTTPFuture.php
--- a/src/future/http/BaseHTTPFuture.php
+++ b/src/future/http/BaseHTTPFuture.php
@@ -245,6 +245,25 @@
}
+ /**
+ * Add a HTTP basic authentication header to the request.
+ *
+ * @param string Username to authenticate with.
+ * @param PhutilOpaqueEnvelope Password to authenticate with.
+ * @return this
+ * @task config
+ */
+ public function setHTTPBasicAuthCredentials(
+ $username,
+ PhutilOpaqueEnvelope $password) {
+
+ $password_plaintext = $password->openEnvelope();
+ $credentials = base64_encode($username.':'.$password_plaintext);
+
+ return $this->addHeader('Authorization', 'Basic '.$credentials);
+ }
+
+
/* -( Resolving the Request )---------------------------------------------- */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 16, 5:52 AM (1 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7655945
Default Alt Text
D8621.id20464.diff (1 KB)
Attached To
Mode
D8621: Support HTTP basic auth in HTTPFuture
Attached
Detach File
Event Timeline
Log In to Comment