dotnet / dotnet/aspnetcore

Windows Authentication Error using Kestrel for .NET Core Web API, when accessed remotely.

Open
#20,540 10 comments 0 reactions 0 assignees View on GitHub
affected-few area-auth blocked External severity-minor task
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

Error in Windows Authentication using Kestrel still reproduce (package Microsoft.AspNetCore.Authentication.Negotiate, guide https://docs.microsoft.com/ru-ru/aspnet/core/security/authentication/windowsauth?view=aspnetcore-3.1&tabs=visual-studio#kestrel).
Same error in related issue. But i collected logs and prepare example to reproduce bug.

Example in branch: https://github.com/Yustos/AspNetCoreSubdomain/commits/auth_trouble
Reproduce steps:

- Compile AspNetCoreSubdomain.Samples.csproj
- Place bin folder to remote server (example.com)
- Run on remote server AspNetCoreSubdomain.Samples.exe in console
- On local computer open http://example.com:5000 in chrome browser

You can see error 404 in browser and this topic error in log.
Or you can try postman get query with NTLM auth - there will be 401 error and same error in server log.

In the fiddler all three negotiate requests exists, bug without success:
№ Result Protocol Host URL Body Caching Content-Type Process Comments Custom
7 401 HTTP example.com:5000 / 0 postman:119596
8 401 HTTP example.com:5000 / 0 postman:119596
9 401 HTTP example.com:5000 / 0 postman:119596

There is connection log, as you ask:
[auth_log.txt](https://github.com/dotnet/aspnetcore/files/4432216/auth_log.txt)

Remark: i replaced server name to ```example.com``` and username from domain to Yustos in attached log.

At last, i was tried HTTP.SYS auth (see commented code in example branch https://github.com/Yustos/AspNetCoreSubdomain/commit/d39dd1f729c34d7ea36f4e807303b1c7687c34a2) - it work fine.

I followed auth example prepare by this guide on windows (client and server): https://docs.microsoft.com/ru-ru/aspnet/core/security/authentication/windowsauth?view=aspnetcore-3.1&tabs=visual-studio#kestrel
Except setspn command: https://docs.microsoft.com/ru-ru/aspnet/core/security/authentication/windowsauth?view=aspnetcore-3.1&tabs=visual-studio#windows-environment-configuration

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.