diff --git a/DigitalData.Auth.Client/ClientParams.cs b/DigitalData.Auth.Client/ClientParams.cs index 6c9db25..d97b73f 100644 --- a/DigitalData.Auth.Client/ClientParams.cs +++ b/DigitalData.Auth.Client/ClientParams.cs @@ -42,5 +42,5 @@ public class ClientParams }); } - public IEnumerable PublicKeys { get; init; } = new List(); + public List PublicKeys { get; init; } = new(); } \ No newline at end of file diff --git a/DigitalData.Auth.Tests/Client/AuthClientTests.cs b/DigitalData.Auth.Tests/Client/AuthClientTests.cs index d949b56..6cd2e8e 100644 --- a/DigitalData.Auth.Tests/Client/AuthClientTests.cs +++ b/DigitalData.Auth.Tests/Client/AuthClientTests.cs @@ -185,4 +185,28 @@ public class AuthClientTests Assert.That(publicKey, Is.EqualTo(expectedPublicKey)); }); } + + [Test] + public async Task StartAsync_ShouldUpdateAllPublicKey() + { + // Arrange + var publicKey = new AsymmetricPublicKey() { Issuer = "Foo", Audience = "Bar" }; + var provider = Build(opt => + { + opt.Url = _hubUrl; + opt.PublicKeys.Add(new AsymmetricPublicKey() { Issuer = "Foo", Audience = "Bar" }); + }); + var client = provider.GetRequiredService(); + await client.StartAsync(); + + // wait for network + await Task.Delay(2000); + + // Act + var expectedPublicKey = _tokenDescriptors.Get("Foo", "Bar").PublicKey; + await client.GetPublicKeyAsync("Foo", "Bar"); + + // Assert + Assert.That(publicKey.Content, Is.EqualTo(expectedPublicKey.Content)); + } } \ No newline at end of file