mirror of
https://github.com/DuendeSoftware/products
synced 2026-05-24 09:28:24 +00:00
Merge pull request #2249 from DuendeSoftware/pg/sync-main
Sync BFF 4.0 with main (including ATM preview packages)
This commit is contained in:
commit
918da5b398
9 changed files with 24 additions and 22 deletions
|
|
@ -42,14 +42,12 @@
|
|||
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
|
||||
<!-- Added aspire transitive package to resolve package vulnerability -->
|
||||
<PackageVersion Include="KubernetesClient" Version="17.0.14" />
|
||||
<PackageVersion Include="Duende.AccessTokenManagement" Version="4.0.0" />
|
||||
<PackageVersion Include="Duende.AccessTokenManagement.OpenIdConnect" Version="4.0.0" />
|
||||
<!-- <PackageVersion Include="Duende.AccessTokenManagement" Version="4.0.0" />
|
||||
<PackageVersion Include="Duende.AccessTokenManagement.OpenIdConnect" Version="4.0.0" /> -->
|
||||
<PackageVersion Include="Duende.AccessTokenManagement" Version="4.1.0-preview.2" />
|
||||
<PackageVersion Include="Duende.AccessTokenManagement.OpenIdConnect" Version="4.1.0-preview.2" />
|
||||
<PackageVersion Include="Duende.AspNetCore.Authentication.JwtBearer" Version="0.1.3" />
|
||||
<PackageVersion Include="Duende.IdentityModel" Version="7.1.0" />
|
||||
<PackageVersion Include="Duende.IdentityModel.OidcClient" Version="6.0.1" />
|
||||
<PackageVersion Include="Duende.IdentityServer" Version="7.1.0" />
|
||||
<PackageVersion Include="Duende.IdentityModel" Version="8.0.0-preview.1" />
|
||||
<PackageVersion Include="Duende.IdentityModel.OidcClient" Version="7.0.0-preview.2" />
|
||||
<PackageVersion Include="Duende.IdentityServer" Version="7.4.0-preview.2" />
|
||||
<PackageVersion Include="Duende.Private.Licensing" Version="1.0.0" />
|
||||
<PackageVersion Include="IdentityModel.AspNetCore.OAuth2Introspection" Version="6.2.0" />
|
||||
<PackageVersion Include="Meziantou.Extensions.Logging.Xunit" Version="1.0.8" />
|
||||
|
|
@ -67,6 +65,7 @@
|
|||
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="$(FrameworkVersion)" />
|
||||
<PackageVersion Include="Microsoft.AspNetCore.TestHost" Version="$(FrameworkVersion)" />
|
||||
<PackageVersion Include="Microsoft.AspNetCore.WebUtilities" Version="2.2.0" />
|
||||
<PackageVersion Include="Microsoft.Build.Tasks.Core" Version="17.14.28" />
|
||||
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="$(EFCoreVersion)" />
|
||||
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="$(EFCoreVersion)" />
|
||||
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="$(EFCoreVersion)" />
|
||||
|
|
@ -75,7 +74,7 @@
|
|||
<PackageVersion Include="Microsoft.Extensions.Caching.Abstractions" Version="$(FrameworkVersion)" />
|
||||
<!-- TODO - Upgrade hybrid cache-->
|
||||
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="$(CachingMemoryVersion)" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Caching.Hybrid" Version="9.3.0" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Caching.Hybrid" Version="9.9.0" />
|
||||
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(FrameworkVersion)" />
|
||||
<!-- TODO - Upgrade diagnostics.testing-->
|
||||
<PackageVersion Include="Microsoft.Extensions.Diagnostics.Testing" Version="8.10.0" />
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) Duende Software. All rights reserved.
|
||||
// See LICENSE in the project root for license information.
|
||||
|
||||
using System.Buffers.Text;
|
||||
using System.Text.Json;
|
||||
using Duende.IdentityModel;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
|
|
@ -44,5 +45,5 @@ internal static class DPoPExtensions
|
|||
/// <summary>
|
||||
/// Create the value of a thumbprint
|
||||
/// </summary>
|
||||
public static string CreateThumbprint(this JsonWebKey jwk) => Base64Url.Encode(jwk.ComputeJwkThumbprint());
|
||||
public static string CreateThumbprint(this JsonWebKey jwk) => Base64Url.EncodeToString(jwk.ComputeJwkThumbprint());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) Duende Software. All rights reserved.
|
||||
// See LICENSE in the project root for license information.
|
||||
|
||||
using System.Buffers.Text;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
|
@ -21,7 +22,7 @@ internal class DPoPProofValidator : IDPoPProofValidator
|
|||
private const string DataProtectorPurpose = "DPoPJwtBearerEvents-DPoPProofValidation-nonce";
|
||||
|
||||
/// <summary>
|
||||
/// Provides the options for DPoP proof validation.
|
||||
/// Provides the options for DPoP proof validation.
|
||||
/// </summary>
|
||||
internal readonly IOptionsMonitor<DPoPOptions> OptionsMonitor;
|
||||
|
||||
|
|
@ -263,7 +264,7 @@ internal class DPoPProofValidator : IDPoPProofValidator
|
|||
var bytes = Encoding.UTF8.GetBytes(context.AccessToken);
|
||||
var hash = SHA256.HashData(bytes);
|
||||
|
||||
var accessTokenHash = Base64Url.Encode(hash);
|
||||
var accessTokenHash = Base64Url.EncodeToString(hash);
|
||||
if (accessTokenHash != result.AccessTokenHash)
|
||||
{
|
||||
result.SetError("Invalid 'ath' value.");
|
||||
|
|
@ -278,7 +279,7 @@ internal class DPoPProofValidator : IDPoPProofValidator
|
|||
return;
|
||||
}
|
||||
var jtiBytes = Encoding.UTF8.GetBytes(jtiString);
|
||||
result.TokenIdHash = Base64Url.Encode(SHA256.HashData(jtiBytes));
|
||||
result.TokenIdHash = Base64Url.EncodeToString(SHA256.HashData(jtiBytes));
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(result.TokenIdHash))
|
||||
|
|
@ -382,7 +383,7 @@ internal class DPoPProofValidator : IDPoPProofValidator
|
|||
skew = dPoPOptions.ServerClockSkew;
|
||||
}
|
||||
|
||||
// we do x2 here because the clock might be before or after, so we're making cache duration
|
||||
// we do x2 here because the clock might be before or after, so we're making cache duration
|
||||
// longer than the likelihood of proof token expiration, which is done before replay
|
||||
skew *= 2;
|
||||
var cacheDuration = dPoPOptions.ProofTokenValidityDuration + skew;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
<PackageReference Include="Duende.IdentityServer" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />
|
||||
<PackageReference Include="Meziantou.Extensions.Logging.Xunit" />
|
||||
<PackageReference Include="Microsoft.Extensions.TimeProvider.Testing" />
|
||||
<PackageReference Include="NSubstitute" />
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) Duende Software. All rights reserved.
|
||||
// See LICENSE in the project root for license information.
|
||||
|
||||
using System.Buffers.Text;
|
||||
using System.Security.Claims;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
|
@ -19,7 +20,7 @@ public abstract class DPoPProofValidatorTestBase
|
|||
{
|
||||
ProofValidator = CreateProofValidator();
|
||||
var jtiBytes = Encoding.UTF8.GetBytes(TokenId);
|
||||
TokenIdHash = Base64Url.Encode(SHA256.HashData(jtiBytes));
|
||||
TokenIdHash = Base64Url.EncodeToString(SHA256.HashData(jtiBytes));
|
||||
Context = new()
|
||||
{
|
||||
Options = Options,
|
||||
|
|
@ -52,7 +53,7 @@ public abstract class DPoPProofValidatorTestBase
|
|||
|
||||
protected DPoPProofValidationResult Result = new();
|
||||
|
||||
// This is just an arbitrary date that we're going to do all our date arithmetic relative to.
|
||||
// This is just an arbitrary date that we're going to do all our date arithmetic relative to.
|
||||
// It was chosen because it is convenient to use - it is well within the range of DateTime
|
||||
protected const long IssuedAt = 1704088800; // Mon Jan 01 2024 06:00:00 GMT+0000
|
||||
protected const long ValidFor = 100;
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
// See LICENSE in the project root for license information.
|
||||
|
||||
|
||||
using System.Buffers.Text;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using Duende.IdentityModel;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
|
||||
namespace IdentityServerHost.Pages.Diagnostics;
|
||||
|
|
@ -18,7 +18,7 @@ public class ViewModel
|
|||
if (result.Properties.Items.ContainsKey("client_list"))
|
||||
{
|
||||
var encoded = result.Properties.Items["client_list"];
|
||||
var bytes = Base64Url.Decode(encoded);
|
||||
var bytes = Base64Url.DecodeFromChars(encoded);
|
||||
var value = Encoding.UTF8.GetString(bytes);
|
||||
|
||||
Clients = JsonSerializer.Deserialize<string[]>(value);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) Duende Software. All rights reserved.
|
||||
// See LICENSE in the project root for license information.
|
||||
|
||||
using System.Buffers.Text;
|
||||
using System.Text.Json;
|
||||
using Duende.IdentityModel;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
|
|
@ -66,7 +67,7 @@ internal static class DPoPExtensions
|
|||
/// </summary>
|
||||
public static string CreateThumbprint(this JsonWebKey jwk)
|
||||
{
|
||||
var jkt = Base64Url.Encode(jwk.ComputeJwkThumbprint());
|
||||
var jkt = Base64Url.EncodeToString(jwk.ComputeJwkThumbprint());
|
||||
return jkt;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// Copyright (c) Duende Software. All rights reserved.
|
||||
// See LICENSE in the project root for license information.
|
||||
|
||||
using System.Buffers.Text;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
|
|
@ -226,7 +227,7 @@ public class DPoPProofValidator
|
|||
var bytes = Encoding.UTF8.GetBytes(context.AccessToken);
|
||||
var hash = sha.ComputeHash(bytes);
|
||||
|
||||
var accessTokenHash = Base64Url.Encode(hash);
|
||||
var accessTokenHash = Base64Url.EncodeToString(hash);
|
||||
if (accessTokenHash != result.AccessTokenHash)
|
||||
{
|
||||
result.IsError = true;
|
||||
|
|
@ -328,7 +329,7 @@ public class DPoPProofValidator
|
|||
skew = dpopOptions.ServerClockSkew;
|
||||
}
|
||||
|
||||
// we do x2 here because clock might be might be before or after, so we're making cache duration
|
||||
// we do x2 here because clock might be might be before or after, so we're making cache duration
|
||||
// longer than the likelyhood of proof token expiration, which is done before replay
|
||||
skew *= 2;
|
||||
var cacheDuration = dpopOptions.ProofTokenValidityDuration + skew;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Yarp.ReverseProxy" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" VersionOverride="9.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
Loading…
Reference in a new issue