Skip to content

Commit da35e59

Browse files
committed
Fix build
1 parent ed78647 commit da35e59

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

src/Identity/ApiAuthorization.IdentityServer/src/Authentication/IdentityServerJwtBearerOptionsConfiguration.cs

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

4-
using Duende.IdentityServer.Extensions;
54
using Duende.IdentityServer.Services;
65
using Duende.IdentityServer.Stores;
76
using Microsoft.AspNetCore.ApiAuthorization.IdentityServer.Configuration;
@@ -17,18 +16,15 @@ internal sealed class IdentityServerJwtBearerOptionsConfiguration : IConfigureNa
1716
private readonly string _scheme;
1817
private readonly string _apiName;
1918
private readonly IIdentityServerJwtDescriptor _localApiDescriptor;
20-
private readonly IIssuerNameService _issuerService;
2119

2220
public IdentityServerJwtBearerOptionsConfiguration(
2321
string scheme,
2422
string apiName,
25-
IIdentityServerJwtDescriptor localApiDescriptor,
26-
IIssuerNameService issuerService)
23+
IIdentityServerJwtDescriptor localApiDescriptor)
2724
{
2825
_scheme = scheme;
2926
_apiName = apiName;
3027
_localApiDescriptor = localApiDescriptor;
31-
_issuerService = issuerService;
3228
}
3329

3430
public void Configure(string name, JwtBearerOptions options)
@@ -64,8 +60,9 @@ internal static async Task ResolveAuthorityAndKeysAsync(MessageReceivedContext m
6460
if (options.TokenValidationParameters.ValidIssuer == null || options.TokenValidationParameters.IssuerSigningKey == null)
6561
{
6662
var store = messageReceivedContext.HttpContext.RequestServices.GetRequiredService<ISigningCredentialStore>();
63+
var issuerService = messageReceivedContext.HttpContext.RequestServices.GetRequiredService<IIssuerNameService>();
6764
var credential = await store.GetSigningCredentialsAsync();
68-
options.Authority = options.Authority ?? await _issuerService.GetCurrentAsync();
65+
options.Authority = options.Authority ?? await issuerService.GetCurrentAsync();
6966
options.TokenValidationParameters.IssuerSigningKey = credential.Key;
7067
options.TokenValidationParameters.ValidIssuer = options.Authority;
7168
}

src/Identity/ApiAuthorization.IdentityServer/src/Extensions/DefaultClientRequestParametersProvider.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public DefaultClientRequestParametersProvider(
1717
{
1818
UrlFactory = urlFactory;
1919
Options = options;
20+
NameService = nameService;
2021
}
2122

2223
public IAbsoluteUrlFactory UrlFactory { get; }

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

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

44
using Duende.IdentityServer.Configuration;
5+
using Duende.IdentityServer.Services;
56
using Microsoft.AspNetCore.Http;
67
using Microsoft.Extensions.DependencyInjection;
78
using Microsoft.Extensions.Options;
@@ -11,6 +12,11 @@ namespace Microsoft.AspNetCore.ApiAuthorization.IdentityServer.Extensions;
1112

1213
public class DefaultClientRequestParametersProviderTests
1314
{
15+
class NameService : IIssuerNameService
16+
{
17+
public Task<string> GetCurrentAsync() => Task.FromResult("http://localhost");
18+
}
19+
1420
[Fact]
1521
public void GetClientParameters_ReturnsParametersForExistingClients()
1622
{
@@ -35,7 +41,8 @@ public void GetClientParameters_ReturnsParametersForExistingClients()
3541
var clientRequestParametersProvider =
3642
new DefaultClientRequestParametersProvider(
3743
absoluteUrlFactory.Object,
38-
options);
44+
options,
45+
new NameService());
3946

4047
var expectedParameters = new Dictionary<string, string>
4148
{

0 commit comments

Comments
 (0)