dotnet / dotnet/Docker.DotNet

How to perform ntlm authentication when using alpine as base image?

Open
#642 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
2.4k
Forks
416
PR merge metrics
No merged PRs in 30d

Description

Hello,

We are trying to make ntlm authentication call to rest api but error is coming. We have followed the steps [mentioned here](https://github.com/mikeTWC1984/gssntlm) but, nothing is working. Our application is hosted in Azure AKS. Any suggestions please

**Code**
```
var cred= new CredentialCache();
cred.Add(new Uri("url"), "NTLM", new NetworkCredential("user", "pwd", "***.com"));

var hwd= new HttpClientHandler() { Credentials = credentialsCache, PreAuthenticate = true };

hwd.ClientCertificateOptions = ClientCertificateOption.Manual;
hwd.ServerCertificateCustomValidationCallback =
(httpRequestMessage, cert, cetChain, policyErrors) => true;
hwd.UseDefaultCredentials = false;

var client = new FlurlClient(new HttpClient(hwd) { Timeout = new TimeSpan(0, 0, 30) };);
var response = await request
.AllowHttpStatus(HttpStatusCode.NotFound)
.WithHeader("Accept", "application/json")
.WithClient(client)
.WithHeader("Content-Type", "application/json; charset=utf-8")
.GetAsync();
```

**Exception**

```
Flurl.Http.FlurlHttpException: Call failed. NTLM authentication is not possible with default credentials on this platform:
System.PlatformNotSupportedException: NTLM authentication is not possible with default credentials on this platform. at
```
**POD base image**
```

NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.16.3
PRETTY_NAME="Alpine Linux v3.16"
```
**dotnet version:- 6.0.14**

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.