title: ASP.NET 5: Configuring IdentityServer3 authentication
body: <p>I've just started digging into the new ASP.NET 5 by creating a test single page application with the OAuth login. I already know that I can use IdentityServer3 for that purpose and it seems pretty nice. I've found a <a href="http://leastprivilege.com/2015/07/22/the-state-of-security-in-asp-net-5-and-mvc-6-oauth-2-0-openid-connect-and-identityserver/" rel="nofollow">post by Dominick Baier</a> which is explaining how to set up the IdentityServer3. However, the post seems to be out of date or the identity server itself isn't working with the latest version of the ASP.NET 5 (which is beta7 at the moment).</p>
  
  <p>The problem is, when I try to configure the IdentityServer in the Startup.cs I got an error from VS telling me that IApplicationBuilder has no extension method called UseIdentityServer. And this seems to be true, since in the IdentityServer3 source code they have this extension method <a href="https://github.com/IdentityServer/IdentityServer3/blob/2.0.1/source/Core/Configuration/AppBuilderExtensions/UseIdentityServerExtension.cs#L51" rel="nofollow">declared for IAppBuilder</a> (not IApplicationBuilder).</p>
  
  <p>Here is my code (Startup.cs):</p>
  
  <pre><code>public void Configure(IApplicationBuilder app, IHostingEnvironment env)
  {
      // Add MVC to the request pipeline.
      app.UseMvc();
  
      var options = new IdentityServerOptions
      {
          Factory = new IdentityServerServiceFactory()
      };
  
      app.UseIdentityServer(options);
  }
  </code></pre>
  
  <p>And the error (on the last line) is</p>
  
  <blockquote>
    <p>'IApplicationBuilder' does not contain a definition for 'UseIdentityServer' and the best extension method overload 'UseIdentityServerExtension.UseIdentityServer(IAppBuilder, IdentityServerOptions)' requires a receiver of type 'IAppBuilder'</p>
  </blockquote>
  
  <p>Obviously, if I change the parameter type in the Configure method to IAppBuiler, it'll throw a runtime error because the dependency injection will not be able to inject that type. Even if it would, I'd lose the UseMvc() extension method.</p>
  
  <p>So could you point me in the right direction please?
  Perhaps I'm just missing something tiny but crucial here.</p>
  
  <p>Thanks in advance!</p>