Skip to content

Commit 3f5ce24

Browse files
authored
switch to new api
1 parent 395ac90 commit 3f5ce24

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
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.Extensions;
5+
using Duende.IdentityServer.Services;
56
using Duende.IdentityServer.Stores;
67
using Microsoft.AspNetCore.ApiAuthorization.IdentityServer.Configuration;
78
using Microsoft.AspNetCore.Authentication.JwtBearer;
@@ -16,15 +17,18 @@ internal class IdentityServerJwtBearerOptionsConfiguration : IConfigureNamedOpti
1617
private readonly string _scheme;
1718
private readonly string _apiName;
1819
private readonly IIdentityServerJwtDescriptor _localApiDescriptor;
20+
private readonly IIssuerNameService _issuerService;
1921

2022
public IdentityServerJwtBearerOptionsConfiguration(
2123
string scheme,
2224
string apiName,
23-
IIdentityServerJwtDescriptor localApiDescriptor)
25+
IIdentityServerJwtDescriptor localApiDescriptor,
26+
IIssuerNameService issuerService)
2427
{
2528
_scheme = scheme;
2629
_apiName = apiName;
2730
_localApiDescriptor = localApiDescriptor;
31+
_issuerService = issuerService;
2832
}
2933

3034
public void Configure(string name, JwtBearerOptions options)
@@ -61,7 +65,7 @@ internal static async Task ResolveAuthorityAndKeysAsync(MessageReceivedContext m
6165
{
6266
var store = messageReceivedContext.HttpContext.RequestServices.GetRequiredService<ISigningCredentialStore>();
6367
var credential = await store.GetSigningCredentialsAsync();
64-
options.Authority = options.Authority ?? messageReceivedContext.HttpContext.GetIdentityServerIssuerUri();
68+
options.Authority = options.Authority ?? await _issuerService.GetCurrentAsync();
6569
options.TokenValidationParameters.IssuerSigningKey = credential.Key;
6670
options.TokenValidationParameters.ValidIssuer = options.Authority;
6771
}

0 commit comments

Comments
 (0)