create scope to resolve named options.

This commit is contained in:
Shannon
2021-07-22 14:47:17 -06:00
parent 560d49d6a5
commit 9ec86f2f86

View File

@@ -45,12 +45,12 @@ namespace Umbraco.Cms.Web.BackOffice.Security
base.Services.AddSingleton(x =>
{
// need to create a scope to resolve IOptionsSnapshot
using (x.CreateScope())
using (IServiceScope serviceScope = x.CreateScope())
{
return new BackOfficeExternalLoginProvider(
displayName,
authenticationScheme,
x.GetRequiredService<IOptionsSnapshot<BackOfficeExternalLoginProviderOptions>>());
serviceScope.ServiceProvider.GetRequiredService<IOptionsSnapshot<BackOfficeExternalLoginProviderOptions>>());
}
});
Services.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<TOptions>, EnsureBackOfficeScheme<TOptions>>());