Ensure to resolve the named options

This commit is contained in:
Shannon
2021-07-22 13:54:46 -06:00
parent 7280c22e0a
commit c3953bb0c1
2 changed files with 3 additions and 3 deletions

View File

@@ -45,7 +45,7 @@ namespace Umbraco.Cms.Web.BackOffice.Security
Services.AddSingleton(x => new BackOfficeExternalLoginProvider(
displayName,
authenticationScheme,
x.GetRequiredService<IOptions<BackOfficeExternalLoginProviderOptions>>()));
x.GetRequiredService<IOptionsSnapshot<BackOfficeExternalLoginProviderOptions>>()));
Services.TryAddEnumerable(ServiceDescriptor.Singleton<IPostConfigureOptions<TOptions>, EnsureBackOfficeScheme<TOptions>>());
return base.AddRemoteScheme<TOptions, THandler>(authenticationScheme, displayName, configureOptions);

View File

@@ -8,7 +8,7 @@ namespace Umbraco.Cms.Web.BackOffice.Security
/// </summary>
public class BackOfficeExternalLoginProvider : IEquatable<BackOfficeExternalLoginProvider>
{
public BackOfficeExternalLoginProvider(string name, string authenticationType, IOptions<BackOfficeExternalLoginProviderOptions> properties)
public BackOfficeExternalLoginProvider(string name, string authenticationType, IOptionsSnapshot<BackOfficeExternalLoginProviderOptions> properties)
{
if (properties is null)
{
@@ -17,7 +17,7 @@ namespace Umbraco.Cms.Web.BackOffice.Security
Name = name ?? throw new ArgumentNullException(nameof(name));
AuthenticationType = authenticationType ?? throw new ArgumentNullException(nameof(authenticationType));
Options = properties.Value;
Options = properties.Get(authenticationType);
}
public string Name { get; }