Skip to content

Commit

Permalink
Fix key store config binding (dotnet#3139)
Browse files Browse the repository at this point in the history
This was missed in dotnet#3033.
  • Loading branch information
drewnoakes authored and radical committed Mar 25, 2024
1 parent 3ca1603 commit 2722266
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Aspire.Dashboard/Model/DashboardClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,11 @@ X509CertificateCollection GetKeyStoreCertificate()
throw new InvalidOperationException("ResourceServiceClient:ClientCertificate:Source is \"KeyStore\", but no Certificate:FilePath is configured.");
}

using var store = new X509Store(storeName: StoreName.My, storeLocation: StoreLocation.CurrentUser);
var storeProperties = new KeyStoreProperties { Name = "My", Location = StoreLocation.CurrentUser };

configuration.Bind("ResourceServiceClient:ClientCertificate:KeyStore");
configuration.Bind("ResourceServiceClient:ClientCertificate:KeyStore", storeProperties);

using var store = new X509Store(storeName: storeProperties.Name, storeLocation: storeProperties.Location);

store.Open(OpenFlags.ReadOnly);

Expand All @@ -189,6 +191,12 @@ X509CertificateCollection GetKeyStoreCertificate()
}
}

internal sealed class KeyStoreProperties
{
public required string Name { get; set; }
public required StoreLocation Location { get; set; }
}

// For testing purposes
internal int OutgoingResourceSubscriberCount => _outgoingChannels.Count;

Expand Down

0 comments on commit 2722266

Please sign in to comment.