I finally worked this out.
This is a solution for a .NET Core web application.
You will have to make overrides in the hosting file: web.config and while developing in the applicationhost.config file.
An example for the web.config file:
<!-- enable logon with cookie -->
<location path="User/Logon">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
<system.webServer>
<security>
<authentication>
<windowsAuthentication enabled="false" />
<anonymousAuthentication enabled="true" />
</authentication>
</security>
</system.webServer>
</location>
An example for the applicationhost.config file:
<sectionGroup name="authentication">
<section name="anonymousAuthentication" overrideModeDefault="Allow" />
<section name="basicAuthentication" overrideModeDefault="Deny" />
<section name="clientCertificateMappingAuthentication" overrideModeDefault="Deny" />
<section name="digestAuthentication" overrideModeDefault="Deny" />
<section name="iisClientCertificateMappingAuthentication" overrideModeDefault="Deny" />
<section name="windowsAuthentication" overrideModeDefault="Allow" />
</sectionGroup>
When hosting on IIS, in the Admin panel this has to be set at the Feature Delegation icon:
Authentication - Anonymous Read/Write
Authentication - Windows Read/Write
This allows for both Windows Authentication and Cookie Authentication. In our case the normal users are authenticated with windows authentication, but we also have other users not known on our network that have to use the web application. This way both can be served. So we have in our web application two Authentication providers: Windows and Cookie authentication.
It can be a policy in some companies this is not allowed, then you need two web front ends, one for windows authentication and one for jwt tokens.