dotnet / dotnet/aspnetcore

Kestrel Windows Auth is not prompting UN/PW challenge on macOS, when server runs on windows AD.

Open
#53,675 2 comments 0 reactions 0 assignees View on GitHub
area-auth investigate
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Describe the bug

I'm struggling to get windows auth working on Kestler.
It kinda works, but only when clients are windows Chrome or IE browsers. When client in MacOS UN/PW challenge is not prompted.

### Expected Behavior

Expected behaviour is that macOS Chrome / Safari would also prompt for username password.

### Steps To Reproduce

Setup keslter server running on windows and enable windows auth like:
Main:
`builder.Services.AddAuthentication(NegotiateDefaults.AuthenticationScheme).AddNegotiate();
//for my case I want Auth to be executed on specific path of URL
app.UseWhen(context => context.Request.Path.StartsWithSegments("/Auth"), specificPathApp => {
specificPathApp.UseAuthentication(); // Apply authentication only for this path
specificPathApp.UseAuthorization();
});`

AuthController:
`public class AuthController : Controller {
[HttpGet]
[Authorize]
public ActionResult Index(string? redirect = null) {
WindowsIdentity? winIdent = User.Identity as WindowsIdentity;
return new ContentResult { Content = "Auth ok, winidentity: name=" + (winIdent?.Name ?? "user not found"), ContentType = "text/plain" };
}
}`

### Exceptions (if any)

_No response_

### .NET Version

8.0.101

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.