Skip to content

Commit 77a8e22

Browse files
committed
Information on how NTLM could be made to work
1 parent ab05166 commit 77a8e22

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,12 @@ You can pass custom curl options to the client with `$curlOptions` constructor p
4747
- `CURLOPT_HEADER` - Headers are set in the request.
4848
- `CURLOPT_WRITEFUNCTION` - The client uses this to get the response body.
4949
- `CURLOPT_HEADERFUNCTION` - The client uses this to get the response headers.
50+
51+
## How do I implement NTLM authentication?
52+
53+
Microsoft is phasing out NTLM. For this reason, NTLM authentication won't be implemented in this library. However, it should be possible with the following curl options:
54+
55+
- `CURLOPT_HTTPAUTH` as `CURLAUTH_NTLM`
56+
- `CURLOPT_USERPWD` with username and password, for example "username:password"
57+
58+
Check [examples.md](examples.md) for an example.

examples.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,21 @@ $request = $request->withHeader('X-MyHeader', 'Data');
2424

2525
// Send the request to get the response. The response is a PSR-7 response.
2626
$response = $client->sendRequest($request);
27-
```
27+
```
28+
29+
## NTLM authentication
30+
31+
```php
32+
<?php
33+
34+
declare(strict_types=1);
35+
36+
use SharkMachine\Psr18Shark\Client;
37+
38+
$factory = new Psr17Factory();
39+
$ntlmAuth = [
40+
CURLOPT_HTTPAUTH => CURLAUTH_NTLM,
41+
CURLOPT_USERPWD => 'username:password',
42+
];
43+
$client = new Client($factory, $factory, curlOptions: $ntlmAuth);
44+
```

0 commit comments

Comments
 (0)