title: On-Premises WebApi not redirecting to authentication
body: <p>For some reason OWIN is not redirecting to the login page especified in ADFS,
  i dont have any control over ADFS(Windows Server 2012), i followed the Microsoft Documentation(<a href="http://www.asp.net/visual-studio/overview/2013/creating-web-projects-in-visual-studio#orgauthonprem" rel="nofollow">http://www.asp.net/visual-studio/overview/2013/creating-web-projects-in-visual-studio#orgauthonprem</a>) but im now stuck.
  I thought that by refering the metadata everything would be configured out of the box.</p>
  
  <p>My Controller(template generated from WebApi)</p>
  
  <pre><code>[Authorize]
  public class ValuesController : ApiController
  {
      // GET api/values
      public IEnumerable&lt;string&gt; Get()
      {
          return new string[] { "value1", "value2" };
      }
  
      // GET api/values/5
      public string Get(int id)
      {
          return "value";
      }
  
      // POST api/values
      public void Post([FromBody]string value)
      {
      }
  
      // PUT api/values/5
      public void Put(int id, [FromBody]string value)
      {
      }
  
      // DELETE api/values/5
      public void Delete(int id)
      {
      }
  }
  </code></pre>
  
  <p>However i get </p>
  
  <pre><code>This XML file does not appear to have any style information associated with it. The document tree is shown below.
  &lt;Error&gt;
  &lt;Message&gt;Authorization has been denied for this request.&lt;/Message&gt;
  &lt;/Error&gt;
  </code></pre>
  
  <p>Am i supposed to implement some kind of based authentication?</p>
  
  <p><strong>UPDATE!</strong><br>
  It seems it was necessary Microsoft.Owin.Security.WsFederation<br>
  However now adfs doesnt redirect to my realm, i get a 302 from ADFS after the user was authenticated.. Something like </p>
  
  <pre><code>/adfs/ls/?wtrealm=http%3a%2f%2flocalhost%3a554&amp;wctx=WsFedOwinState%3d9C7kwsHRjBM86yrii5niUWF1gW9VFvCKBTj_D3z4-QQ5P25opteVK0mWf0fudEQdsgIexkHxTxhKDqBmfSWNAuJ3togHTBE40CEKYa8JLKJOxsgxNGIreYBOzNYzK8NNvR26PCMCowCFoM9NGJOC8w&amp;wa=wsignin1.0
  </code></pre>
  
  <p>My Startup.cs</p>
  
  <pre><code>public partial class Startup
  {
      // For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
      public void ConfigureAuth(IAppBuilder app)
      {
          app.SetDefaultSignInAsAuthenticationType(WsFederationAuthenticationDefaults.AuthenticationType);
  
          app.UseWsFederationAuthentication(new WsFederationAuthenticationOptions
          {
              MetadataAddress = ConfigurationManager.AppSettings["ida:AdfsMetadataEndpoint"],
              Wtrealm = ConfigurationManager.AppSettings["ida:Audience"],
          });
          app.UseCookieAuthentication(new CookieAuthenticationOptions
          {
              AuthenticationType = WsFederationAuthenticationDefaults.AuthenticationType
          });
      }
  }
  </code></pre>
  
  <p>How can i tell ADFS to redirect to the realm?</p>