You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 14, 2020. It is now read-only.
Is there a good way to get the ServiceProvider in the AddOpenIdConnect, or configure the ClientSecret later where we have the DI container fully setup? (e.g. in Configure(IApplicationBuilder app))
We're getting the client secret from somewhere else and we like to use DI for that.
Minimal working example
Currently we do this, but I really like to remove services.BuildServiceProvider()
// This method gets called by the runtime. Use this method to add services to the container.publicvoid ConfigureServices(IServiceCollectionservices){
services.AddOpenIdConnect(AuthenticationScheme, options =>{ServiceProviderserviceProvider= services.BuildServiceProvider();// we like to prevent this
options.ClientSecret = serviceProvider.GetRequiredService<ISecretRetriever>().GetClientSecret();
Note: For events like OnValidatePrincipal we could get it from CookieValidatePrincipalContext.HttpContext.RequestServices
We get also now this warning:
warning "Calling 'BuildServiceProvider' from application code results in a additional copy of Singleton services being created"
The text was updated successfully, but these errors were encountered:
Question
Is there a good way to get the
ServiceProvider
in theAddOpenIdConnect
, or configure the ClientSecret later where we have the DI container fully setup? (e.g. inConfigure(IApplicationBuilder app)
)We're getting the client secret from somewhere else and we like to use DI for that.
Minimal working example
Currently we do this, but I really like to remove
services.BuildServiceProvider()
Note: For events like OnValidatePrincipal we could get it from
CookieValidatePrincipalContext.HttpContext.RequestServices
We get also now this warning:
The text was updated successfully, but these errors were encountered: