Skip to content

Commit 2476f3c

Browse files
cesargbshaedrich
andauthored
Add NTLM authentication support to Http Client (#56475)
* Add NTLM authentication support to Http Client * Update phpdoc Co-authored-by: Sebastian Hädrich <[email protected]> --------- Co-authored-by: Sebastian Hädrich <[email protected]>
1 parent 477b703 commit 2476f3c

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/Illuminate/Http/Client/PendingRequest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,20 @@ public function withDigestAuth($username, $password)
471471
});
472472
}
473473

474+
/**
475+
* Specify the NTLM authentication username and password for the request.
476+
*
477+
* @param string $username
478+
* @param string $password
479+
* @return $this
480+
*/
481+
public function withNtlmAuth($username, $password)
482+
{
483+
return tap($this, function () use ($username, $password) {
484+
$this->options['auth'] = [$username, $password, 'ntlm'];
485+
});
486+
}
487+
474488
/**
475489
* Specify an authorization token for the request.
476490
*

src/Illuminate/Support/Facades/Http.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
* @method static \Illuminate\Http\Client\PendingRequest replaceHeaders(array $headers)
5050
* @method static \Illuminate\Http\Client\PendingRequest withBasicAuth(string $username, string $password)
5151
* @method static \Illuminate\Http\Client\PendingRequest withDigestAuth(string $username, string $password)
52+
* @method static \Illuminate\Http\Client\PendingRequest withNtlmAuth(string $username, string $password)
5253
* @method static \Illuminate\Http\Client\PendingRequest withToken(string $token, string $type = 'Bearer')
5354
* @method static \Illuminate\Http\Client\PendingRequest withUserAgent(string|bool $userAgent)
5455
* @method static \Illuminate\Http\Client\PendingRequest withUrlParameters(array $parameters = [])

0 commit comments

Comments
 (0)