mirror of
https://github.com/DuendeSoftware/products
synced 2026-05-24 09:28:24 +00:00
Rectify Base64 related Encoding and Decoding method calls
This commit is contained in:
parent
da745b8988
commit
d6324086ce
5 changed files with 8 additions and 6 deletions
|
|
@ -74,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" />
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
// See LICENSE in the project root for license information.
|
||||
|
||||
|
||||
using System.Buffers.Text;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using Duende.IdentityModel;
|
||||
|
|
@ -18,7 +19,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