ddcc3432
ddcc3432

Reputation: 479

UseIdentityServerAuthentication for Owin API - .NET Core issue

Is it possible to configure an older Owin WebAPI project to use identityserver4?

In the Owin Startup.cs file there is an IAppBuilder app object, however the UseIdentityServerAuthentication extension method requires an IApplicationBuilder app. This seems to be a difference between .NET Core and Owin.

How do I get UseIdentityServerAuthentication to work with the old IAppBuilder?

public class Startup
{
    public void Configuration(IAppBuilder app)
    {
        // Obviously this won't work. I added this to help explain the issue.
        IApplicationBuilder app2 = (IApplicationBuilder)app;
        app2.UseIdentityServerAuthentication(
         new IdentityServerAuthenticationOptions()
         {
             Authority = "http://localhost:8080",
             RequireHttpsMetadata = false,
             ApiName =" apiName"
         });
    }
}

Upvotes: 0

Views: 1849

Answers (1)

leastprivilege
leastprivilege

Reputation: 18482

This repo shows a couple of permutations of IdentityServer 3 and 4 used by Katana/OWIN and ASP.NET Core APIs

https://github.com/IdentityServer/CrossVersionIntegrationTests

This has everything you need.

Upvotes: 1

Related Questions