Skip to content

Update duende versions to 6.0.4 #41370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
May 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -248,11 +248,11 @@
<GrpcAuthVersion>2.45.0</GrpcAuthVersion>
<GrpcNetClientVersion>2.45.0</GrpcNetClientVersion>
<GrpcToolsVersion>2.45.0</GrpcToolsVersion>
<DuendeIdentityServerAspNetIdentityVersion>5.2.0</DuendeIdentityServerAspNetIdentityVersion>
<DuendeIdentityServerEntityFrameworkVersion>5.2.0</DuendeIdentityServerEntityFrameworkVersion>
<DuendeIdentityServerVersion>5.2.0</DuendeIdentityServerVersion>
<DuendeIdentityServerStorageVersion>5.2.0</DuendeIdentityServerStorageVersion>
<DuendeIdentityServerEntityFrameworkStorageVersion>5.2.0</DuendeIdentityServerEntityFrameworkStorageVersion>
<DuendeIdentityServerAspNetIdentityVersion>6.0.4</DuendeIdentityServerAspNetIdentityVersion>
<DuendeIdentityServerEntityFrameworkVersion>6.0.4</DuendeIdentityServerEntityFrameworkVersion>
<DuendeIdentityServerVersion>6.0.4</DuendeIdentityServerVersion>
<DuendeIdentityServerStorageVersion>6.0.4</DuendeIdentityServerStorageVersion>
<DuendeIdentityServerEntityFrameworkStorageVersion>6.0.4</DuendeIdentityServerEntityFrameworkStorageVersion>
<MessagePackVersion>2.1.90</MessagePackVersion>
<MicrosoftIdentityWebVersion>1.16.0</MicrosoftIdentityWebVersion>
<MicrosoftIdentityWebMicrosoftGraphVersion>1.16.0</MicrosoftIdentityWebMicrosoftGraphVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ internal static async Task ResolveAuthorityAndKeysAsync(MessageReceivedContext m
{
var store = messageReceivedContext.HttpContext.RequestServices.GetRequiredService<ISigningCredentialStore>();
var credential = await store.GetSigningCredentialsAsync();
#pragma warning disable 0618
options.Authority = options.Authority ?? messageReceivedContext.HttpContext.GetIdentityServerIssuerUri();
#pragma warning restore 0618
options.TokenValidationParameters.IssuerSigningKey = credential.Key;
options.TokenValidationParameters.ValidIssuer = options.Authority;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ public DefaultClientRequestParametersProvider(
public IDictionary<string, string> GetClientParameters(HttpContext context, string clientId)
{
var client = Options.Value.Clients[clientId];
#pragma warning disable 0618
// Deprecated in Identity Server 6.0
var authority = context.GetIdentityServerIssuerUri();
#pragma warning restore 0618
if (!client.Properties.TryGetValue(ApplicationProfilesPropertyNames.Profile, out var type))
{
throw new InvalidOperationException($"Can't determine the type for the client '{clientId}'");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Security.Cryptography;
using Duende.IdentityServer.Configuration;
using Duende.IdentityServer.Services;
using Duende.IdentityServer.Stores;
using Microsoft.AspNetCore.ApiAuthorization.IdentityServer.Configuration;
using Microsoft.AspNetCore.Authentication;
Expand Down Expand Up @@ -59,12 +60,16 @@ public async Task ResolveAuthorityAndKeysAsync_SetsUpAuthorityAndKeysOnTheTokenV
credentialsStore.Setup(cs => cs.GetSigningCredentialsAsync())
.ReturnsAsync(new SigningCredentials(key, "RS256"));

var issuerName = new Mock<IIssuerNameService>();
issuerName.Setup(i => i.GetCurrentAsync()).ReturnsAsync("https://localhost");

var context = new DefaultHttpContext();
context.Request.Scheme = "https";
context.Request.Host = new HostString("localhost");
context.RequestServices = new ServiceCollection()
.AddSingleton(new IdentityServerOptions())
.AddSingleton(credentialsStore.Object)
.AddSingleton(issuerName.Object)
.BuildServiceProvider();

var options = new JwtBearerOptions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using Duende.IdentityServer.Configuration;
using Duende.IdentityServer.Services;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
Expand All @@ -11,6 +12,11 @@ namespace Microsoft.AspNetCore.ApiAuthorization.IdentityServer.Extensions;

public class DefaultClientRequestParametersProviderTests
{
class NameService : IIssuerNameService
{
public Task<string> GetCurrentAsync() => Task.FromResult("http://localhost");
}

[Fact]
public void GetClientParameters_ReturnsParametersForExistingClients()
{
Expand All @@ -30,6 +36,7 @@ public void GetClientParameters_ReturnsParametersForExistingClients()
context.Request.Host = new HostString("localhost");
context.RequestServices = new ServiceCollection()
.AddSingleton(new IdentityServerOptions())
.AddSingleton<IIssuerNameService>(new NameService())
.BuildServiceProvider();

var clientRequestParametersProvider =
Expand Down