From 087f9c9ab89997bb7d076db5c4d6ead75330cf75 Mon Sep 17 00:00:00 2001 From: Cesar Date: Mon, 28 Jul 2025 21:45:16 +0200 Subject: [PATCH 1/2] Add NTLM authentication support to Http Client --- src/Illuminate/Http/Client/PendingRequest.php | 14 ++++++++++++++ src/Illuminate/Support/Facades/Http.php | 1 + 2 files changed, 15 insertions(+) diff --git a/src/Illuminate/Http/Client/PendingRequest.php b/src/Illuminate/Http/Client/PendingRequest.php index 120329743ff8..40cd412007bd 100644 --- a/src/Illuminate/Http/Client/PendingRequest.php +++ b/src/Illuminate/Http/Client/PendingRequest.php @@ -471,6 +471,20 @@ public function withDigestAuth($username, $password) }); } + /** + * Specify the digest authentication username and password for the request. + * + * @param string $username + * @param string $password + * @return $this + */ + public function withNtlmAuth($username, $password) + { + return tap($this, function () use ($username, $password) { + $this->options['auth'] = [$username, $password, 'ntlm']; + }); + } + /** * Specify an authorization token for the request. * diff --git a/src/Illuminate/Support/Facades/Http.php b/src/Illuminate/Support/Facades/Http.php index 1ff8a0724d1d..9eeaa7990dc4 100644 --- a/src/Illuminate/Support/Facades/Http.php +++ b/src/Illuminate/Support/Facades/Http.php @@ -49,6 +49,7 @@ * @method static \Illuminate\Http\Client\PendingRequest replaceHeaders(array $headers) * @method static \Illuminate\Http\Client\PendingRequest withBasicAuth(string $username, string $password) * @method static \Illuminate\Http\Client\PendingRequest withDigestAuth(string $username, string $password) + * @method static \Illuminate\Http\Client\PendingRequest withNtlmAuth(string $username, string $password) * @method static \Illuminate\Http\Client\PendingRequest withToken(string $token, string $type = 'Bearer') * @method static \Illuminate\Http\Client\PendingRequest withUserAgent(string|bool $userAgent) * @method static \Illuminate\Http\Client\PendingRequest withUrlParameters(array $parameters = []) From cc5fa0a9f871387d75e20fc2a72ab671df89c056 Mon Sep 17 00:00:00 2001 From: Cesar Garcia Date: Wed, 30 Jul 2025 10:42:52 +0200 Subject: [PATCH 2/2] Update phpdoc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Sebastian Hädrich <11225821+shaedrich@users.noreply.github.com> --- src/Illuminate/Http/Client/PendingRequest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Http/Client/PendingRequest.php b/src/Illuminate/Http/Client/PendingRequest.php index 40cd412007bd..66fc30286b29 100644 --- a/src/Illuminate/Http/Client/PendingRequest.php +++ b/src/Illuminate/Http/Client/PendingRequest.php @@ -472,7 +472,7 @@ public function withDigestAuth($username, $password) } /** - * Specify the digest authentication username and password for the request. + * Specify the NTLM authentication username and password for the request. * * @param string $username * @param string $password