Skip to content

Commit 175b420

Browse files
committed
Fix tests
1 parent da35e59 commit 175b420

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/Identity/ApiAuthorization.IdentityServer/test/Authentication/LocalApiJwtBearerConfigurationTest.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
// Licensed to the .NET Foundation under one or more agreements.
1+
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

44
using System.Security.Cryptography;
55
using Duende.IdentityServer.Configuration;
6+
using Duende.IdentityServer.Services;
67
using Duende.IdentityServer.Stores;
78
using Microsoft.AspNetCore.ApiAuthorization.IdentityServer.Configuration;
89
using Microsoft.AspNetCore.Authentication;
@@ -59,12 +60,16 @@ public async Task ResolveAuthorityAndKeysAsync_SetsUpAuthorityAndKeysOnTheTokenV
5960
credentialsStore.Setup(cs => cs.GetSigningCredentialsAsync())
6061
.ReturnsAsync(new SigningCredentials(key, "RS256"));
6162

63+
var issuerName = new Mock<IIssuerNameService>();
64+
issuerName.Setup(i => i.GetCurrentAsync()).ReturnsAsync("https://localhost");
65+
6266
var context = new DefaultHttpContext();
6367
context.Request.Scheme = "https";
6468
context.Request.Host = new HostString("localhost");
6569
context.RequestServices = new ServiceCollection()
6670
.AddSingleton(new IdentityServerOptions())
6771
.AddSingleton(credentialsStore.Object)
72+
.AddSingleton(issuerName.Object)
6873
.BuildServiceProvider();
6974

7075
var options = new JwtBearerOptions();

src/Identity/ApiAuthorization.IdentityServer/test/Extensions/DefaultClientRequestParametersProviderTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,19 @@ public void GetClientParameters_ReturnsParametersForExistingClients()
3232
.WithLogoutRedirectUri("authentication/logout-callback"));
3333

3434
var context = new DefaultHttpContext();
35+
var nameService = new NameService();
3536
context.Request.Scheme = "http";
3637
context.Request.Host = new HostString("localhost");
3738
context.RequestServices = new ServiceCollection()
3839
.AddSingleton(new IdentityServerOptions())
40+
.AddSingleton<IIssuerNameService>(nameService)
3941
.BuildServiceProvider();
4042

4143
var clientRequestParametersProvider =
4244
new DefaultClientRequestParametersProvider(
4345
absoluteUrlFactory.Object,
4446
options,
45-
new NameService());
47+
nameService);
4648

4749
var expectedParameters = new Dictionary<string, string>
4850
{

0 commit comments

Comments
 (0)