Skip to content

Commit

Permalink
Merge pull request #1375 from DuendeSoftware/joe/signing-algorithms-c…
Browse files Browse the repository at this point in the history
…onfig

Fix KeyManagementOptions binding
  • Loading branch information
brockallen authored Jul 19, 2023
2 parents 9e7ea0b + a86f922 commit dedbc93
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using static Duende.IdentityServer.IdentityServerConstants;
Expand All @@ -31,7 +32,7 @@ public class KeyManagementOptions
/// If none are specified, then "RS256" will be used as the default.
/// The first in the collection will be used as the default.
/// </summary>
public IEnumerable<SigningAlgorithmOptions> SigningAlgorithms { get; set; } = Enumerable.Empty<SigningAlgorithmOptions>();
public ICollection<SigningAlgorithmOptions> SigningAlgorithms { get; set; } = new List<SigningAlgorithmOptions>();

internal string DefaultSigningAlgorithm => SigningAlgorithms.First().Name;
internal IEnumerable<string> AllowedSigningAlgorithmNames => SigningAlgorithms.Select(x => x.Name);
Expand Down Expand Up @@ -160,9 +161,18 @@ internal void Validate()
/// </summary>
public class SigningAlgorithmOptions
{
/// <summary>
/// Parameterless constructor, required for binding
/// </summary>
public SigningAlgorithmOptions()
{

}

/// <summary>
/// Constructor.
/// </summary>
[SetsRequiredMembers]
public SigningAlgorithmOptions(string name)
{
Name = name ?? throw new ArgumentNullException(nameof(name));
Expand All @@ -171,7 +181,7 @@ public SigningAlgorithmOptions(string name)
/// <summary>
/// The algorithm name.
/// </summary>
public string Name { get; set; }
public required string Name { get; set; }

/// <summary>
/// Indicates if an X.509 certificate is to be used to contain the key. Defaults to false.
Expand Down

0 comments on commit dedbc93

Please sign in to comment.