Closed huysentruitw closed 9 years ago
I've asked for some clarification on #1 since multiple copies of the middleware doesn't imply multiple request lifetime scopes. Is the desired end result multiple middlewares + one request lifetime; or multiple middlewares + one request scope per middleware instance? Just to make sure this addresses the issue.
I like the solution, though - it's nice and tidy.
I'm going to pull this in and publish it to MyGet for testing prior to pushing to NuGet officially.
Do you get a chance to test this @huysentruitw?
Until now, I failed to create a NuGet package that ILmerges those assemblies (lacking experience :p). Maybe @brockallen is better placed to perform this test directly in IdentityServer?
I would not release this PR in the official library yet. While this fixes the setup of different copies of the assembly, there still is an issue with Autofac.Owin when you use it twice on the same pipeline:
app.Map("/a", appA => appA.UseWhateverA());
app.Map("/b", appB => appB.UseWhateverB());
Now, when both middlewares use Autofac.Owin while sharing the same Autofac.Owin library, only the first one gets registered correctly. This should be fixed IMO as it breaks the pluggable nature of OWIN and we don't want to drop Autofac as IoC container just yet :)
For reference (i.e., next time I'm looking in here) this discussion is continued over on issue #2.
Transparent fix for #1