public void DenyAnonymous_WithoutCredentials_401() { var denyAnon = new DenyAnonymousMiddleware(SimpleApp); IDictionary<string, object> emptyEnv = CreateEmptyRequest(); denyAnon.Invoke(emptyEnv).Wait(); Assert.Equal(401, emptyEnv.Get<int>("owin.ResponseStatusCode")); var responseHeaders = emptyEnv.Get<IDictionary<string, string[]>>("owin.ResponseHeaders"); Assert.Equal(0, responseHeaders.Count); }
public void DenyAnonymous_WithCredentials_PassedThrough() { var denyAnon = new DenyAnonymousMiddleware(SimpleApp); IDictionary<string, object> emptyEnv = CreateEmptyRequest(); emptyEnv["server.User"] = new GenericPrincipal(new GenericIdentity("bob"), null); denyAnon.Invoke(emptyEnv).Wait(); Assert.Equal(DefaultStatusCode, emptyEnv.Get<int>("owin.ResponseStatusCode")); var responseHeaders = emptyEnv.Get<IDictionary<string, string[]>>("owin.ResponseHeaders"); Assert.Equal(0, responseHeaders.Count); }