Windows Auth with Microsoft.Owin.Testing.TestServer

I have a Web API application that I am securing with Windows Authentication (it will translate to AD locally in a production environment). I just started adding features that rely on authenticating and / or getting properties of the current user, and I immediately fell on the roadblock: the testing server doesn't seem to be able to authenticate.

How can I make the following test code to send an authenticated request using Windows Authentication?

using (var server = Microsoft.Owin.Testing.TestServer.Create(MyApp.Startup.Configure)) {
    var response = server.HttpClient.GetAsync(url).Result;
    // Assert things about the response
}

      

+3
authentication asp.net-web-api testing owin windows-authentication


source to share


No one has answered this question yet

Check out similar questions:

206
Security of REST authentication schemes
144
passport.js RESTful auth
55
How are bearer tokens stored on the server side in Web API 2?
31
Failed to authenticate ASP.NET Web Api service with HttpClient
17
Authenticating with Microsoft.Owin.Testing.TestServer to test memory integration
five
WebAPI with Windows Authentication returns 401 unauthorized
3
Accessing Authenticated Web API windows through Angular 2 without login prompt
2
Web API Basic Authentication Issue in IIS 8 Works on Windows 2012R2
0
Kerberos, windows authentocation request in javascript



All Articles
Loading...
X
Show
Funny
Dev
Pics