Skip to content

Add NTLM authentication support to Http Client #56475

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/Illuminate/Http/Client/PendingRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,20 @@ public function withDigestAuth($username, $password)
});
}

/**
* Specify the NTLM 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.
*
Expand Down
1 change: 1 addition & 0 deletions src/Illuminate/Support/Facades/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [])
Expand Down