// <auto-generated/> #nullable enable annotations #nullable disable warnings // Suppress warnings about [Obsolete] member usage in generated code. #pragma warning disable CS0612, CS0618 namespace System.Runtime.CompilerServices { using System; using System.CodeDom.Compiler; [GeneratedCode("Microsoft.Extensions.Configuration.Binder.SourceGeneration", "12.0.14.46018")] [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] file sealed class InterceptsLocationAttribute : Attribute { public InterceptsLocationAttribute(int version, string data) { } } } namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration { using Microsoft.Extensions.Configuration; using System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Runtime.CompilerServices; [GeneratedCode("Microsoft.Extensions.Configuration.Binder.SourceGeneration", "12.0.14.46018")] file static class BindingExtensions { #region IConfiguration extensions. /// <summary>Attempts to bind the configuration instance to a new instance of type T.</summary> [InterceptsLocation(1, "QddN1eqlsEohW4Y+eUHMvnMFAABTaWduaW5nS2V5c0hhbmRsZXIuY3M=")] // /_/src/aspnetcore/src/Tools/dotnet-user-jwts/src/Helpers/SigningKeysHandler.cs(40,14) public static T? Get<T>(this IConfiguration configuration) => (T?)(GetCore(configuration, typeof(T), configureOptions: null) ?? default(T)); #endregion IConfiguration extensions. #region Core binding extensions. private readonly static Lazy<global::System.Collections.Generic.HashSet<string>> s_configKeys_Microsoft__AspNetCore__Authentication__JwtBearer__Tools__SigningKey = new(() => new global::System.Collections.Generic.HashSet<string>(StringComparer.OrdinalIgnoreCase) { "Id", "Issuer", "Value", "Length" }); public static object? GetCore(this IConfiguration configuration, Type type, Action<BinderOptions>? configureOptions) { ArgumentNullException.ThrowIfNull(configuration); BinderOptions? binderOptions = GetBinderOptions(configureOptions); if (!HasValueOrChildren(configuration)) { return null; } if (type == typeof(global::Microsoft.AspNetCore.Authentication.JwtBearer.Tools.SigningKey[])) { var instance = new global::Microsoft.AspNetCore.Authentication.JwtBearer.Tools.SigningKey[0]; BindCore(configuration, ref instance, defaultValueIfNotFound: true, binderOptions); return instance; } throw new NotSupportedException($"Unable to bind to type '{type}': generator did not detect the type as input."); } public static void BindCore(IConfiguration configuration, ref global::Microsoft.AspNetCore.Authentication.JwtBearer.Tools.SigningKey instance, bool defaultValueIfNotFound, BinderOptions? binderOptions) { ValidateConfigurationKeys(typeof(global::Microsoft.AspNetCore.Authentication.JwtBearer.Tools.SigningKey), s_configKeys_Microsoft__AspNetCore__Authentication__JwtBearer__Tools__SigningKey, configuration, binderOptions); } public static void BindCore(IConfiguration configuration, ref global::Microsoft.AspNetCore.Authentication.JwtBearer.Tools.SigningKey[] instance, bool defaultValueIfNotFound, BinderOptions? binderOptions) { var temp1 = new List<global::Microsoft.AspNetCore.Authentication.JwtBearer.Tools.SigningKey>(); foreach (IConfigurationSection section in configuration.GetChildren()) { if (!string.IsNullOrEmpty(section.Value) && !section.GetChildren().Any()) { continue; } var value = InitializeMicrosoft__AspNetCore__Authentication__JwtBearer__Tools__SigningKey(section, binderOptions); BindCore(section, ref value, defaultValueIfNotFound: false, binderOptions); temp1.Add(value); } int originalCount = instance.Length; Array.Resize(ref instance, originalCount + temp1.Count); temp1.CopyTo(instance, originalCount); } public static global::Microsoft.AspNetCore.Authentication.JwtBearer.Tools.SigningKey InitializeMicrosoft__AspNetCore__Authentication__JwtBearer__Tools__SigningKey(IConfiguration configuration, BinderOptions? binderOptions) { string Id = configuration["Id"]; string Issuer = configuration["Issuer"]; string Value = configuration["Value"]; int Length = default; if (TryGetConfigurationValue(configuration, key: "Length", out string? value3) && value3 is not null) { Length = ParseInt(value3, configuration.GetSection("Length").Path); } else { throw new InvalidOperationException("Cannot create instance of type 'Microsoft.AspNetCore.Authentication.JwtBearer.Tools.SigningKey' because parameter 'Length' has no matching config. Each parameter in the constructor that does not have a default value must have a corresponding config entry."); } return new global::Microsoft.AspNetCore.Authentication.JwtBearer.Tools.SigningKey(Id, Issuer, Value, Length) { Id = Id, Issuer = Issuer, Value = Value, Length = Length, }; } /// <summary>Tries to get the configuration value for the specified key.</summary> public static bool TryGetConfigurationValue(IConfiguration configuration, string key, out string? value) { if (configuration is ConfigurationSection section) { return section.TryGetValue(key, out value); } value = key != null ? configuration[key] : configuration is IConfigurationSection sec ? sec.Value : null; return value != null; } /// <summary>If required by the binder options, validates that there are no unknown keys in the input configuration object.</summary> public static void ValidateConfigurationKeys(Type type, Lazy<global::System.Collections.Generic.HashSet<string>> keys, IConfiguration configuration, BinderOptions? binderOptions) { if (binderOptions?.ErrorOnUnknownConfiguration is true) { global::System.Collections.Generic.List<string>? temp = null; foreach (IConfigurationSection section in configuration.GetChildren()) { if (!keys.Value.Contains(section.Key)) { (temp ??= new global::System.Collections.Generic.List<string>()).Add($"'{section.Key}'"); } } if (temp is not null) { throw new InvalidOperationException($"'ErrorOnUnknownConfiguration' was set on the provided BinderOptions, but the following properties were not found on the instance of {type}: {string.Join(", ", temp)}"); } } } public static bool HasValueOrChildren(IConfiguration configuration) { if ((configuration as IConfigurationSection)?.Value is not null) { return true; } return AsConfigWithChildren(configuration) is not null; } public static IConfiguration? AsConfigWithChildren(IConfiguration configuration) { foreach (IConfigurationSection _ in configuration.GetChildren()) { return configuration; } return null; } public static BinderOptions? GetBinderOptions(Action<BinderOptions>? configureOptions) { if (configureOptions is null) { return null; } BinderOptions binderOptions = new(); configureOptions(binderOptions); if (binderOptions.BindNonPublicProperties) { throw new NotSupportedException($"The configuration binding source generator does not support 'BinderOptions.BindNonPublicProperties'."); } return binderOptions; } public static int ParseInt(string value, string? path) { try { return int.Parse(value, NumberStyles.Integer, CultureInfo.InvariantCulture); } catch (Exception exception) { throw new InvalidOperationException($"Failed to convert configuration value '{value ?? "null"}' at '{path}' to type '{typeof(int)}'.", exception); } } #endregion Core binding extensions. } }