/// <summary> /// Adds IdentityServer to the pipeline. /// </summary> /// <param name="app">The application.</param> /// <param name="options">The options.</param> /// <returns></returns> public static IApplicationBuilder UseIdentityServer(this IApplicationBuilder app, IdentityServerMiddlewareOptions options = null) { app.Validate(); app.UseMiddleware <BaseUrlMiddleware>(); app.ConfigureCors(); app.UseMiddleware <DynamicSchemeAuthenticationMiddleware>(); // it seems ok if we have UseAuthentication more than once in the pipeline -- // this will just re-run the various callback handlers and the default authN // handler, which just re-assigns the user on the context. claims transformation // will run twice, since that's not cached (whereas the authN handler result is) // related: https://github.com/aspnet/Security/issues/1399 if (options == null) { options = new IdentityServerMiddlewareOptions(); } options.AuthenticationMiddleware(app); app.UseMiddleware <MutualTlsEndpointMiddleware>(); app.UseMiddleware <IdentityServerMiddleware>(); return(app); }
public void Options(IdentityServerMiddlewareOptions options) { IdentityServerOptions = options; }