IdentityServer / IdentityServer3

OpenID Connect Provider and OAuth 2.0 Authorization Server Framework for ASP.NET 4.x/Katana
https://identityserver.github.io/Documentation/
Apache License 2.0
2.01k stars 763 forks source link

Inject the same singleton in user service and mvc controller #3827

Closed janobrestad closed 7 years ago

janobrestad commented 7 years ago

In our system we have a custom user service that calls out to an external web api to get information about the users. This wep api is also secured by our identity server.

Into this user service we inject a singleton that keeps the access token for talking to the user web api, and is responsible for renewing it if it has expired.

We're using partial login which redirects to a controller. In this controller we also need access to the user web api.

Is it possible to inject the same singleton into this controller as the one injected into the user service?

How would one do this?

I can find no documentation or samples showing how this should be done.

brockallen commented 7 years ago

This seems to be a general question about IdentityServer - not a bug report or an issue.

Please use StackOverflow for that. This has the advantage that questions and answers can be easily found by search engines, and that there are more people answering questions than just us.

For IdentityServer3 https://stackoverflow.com/questions/tagged/?tagnames=identityserver3&sort=newest

For IdentityServer4 https://stackoverflow.com/questions/tagged/?tagnames=identityserver4&sort=newest

For commercial support https://identityserver.io/