-
-
Notifications
You must be signed in to change notification settings - Fork 764
Getting access to the Autofac Container #828
Comments
This question has been asked many times -- please search the archives. |
So from what I can gather as a design decision you do not expose the internals of IdentityServer so getting access to it's container is a no go. OK, I can respect that. After looking at some of the other comment I went with the route of implementing my own container. The tricky part was to get it integrated into the OWIN message lifetime. It might be helpful if you could provide something similar in the DI documentation but in the mean time for the benefit of others I'll document my solution here:
|
I guess what I'm confused about is why you're so tightly integrating IdentityServer in with another application (the other one that has its own DI system). |
The code I'm integrating with in question has a UI/Host component and a back end business component. The host can be WebApi, MVC, IdentityServer, NServiceBus etc and for any given host entry point it can leverage the same business logic which heavily uses IOC interception for logging and aspects and also nhibernate where session management is tied to the IOC lifetime. Also the existing app has it's own login page with logic for login validation, reset password, forgot password etc. I'm in the process of moving this login functionality to IdentityServer and therefore want to leverage the same back end stack. Rather than having to tweak everything to work with another IOC registration system it's much easier to just provide the existing autofac registrations and set the lifetime properly and the rest works without change. The alternative would be a lot of work. |
Much like my answer here: #819 (comment) We've not designed IdentityServer to intermingle with other application frameworks. If you can get it to work, then great, but it's not intentional on our part and we don't plan on guaranteeing that it will work in the future. Building a token service is complex enough -- supporting what you're asking for is beyond our bandwidth. Sorry. |
Is there any way I can get to the Autofac container when IdentityServer is coming up? I have an existing robust back-end stack I'm leveraging which already uses Autofac and being able to just reuse the registrations would save me a lot of time rather than having to implement everything in your DI wrapper which is nowhere near as robust.
I just need access to the application container via a static or preferably something on the IdentityServerServiceFactory that would expose it so that I can update it with my registrations. Looking at the source code it seems you guys did a really good job at hiding it, excessively so IMO.
The text was updated successfully, but these errors were encountered: