mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 23:52:50 -05:00
Fix WebAuthn not working after move to System.Text.Json (#1818)
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Utilities;
|
||||
using Fido2NetLib.Objects;
|
||||
|
||||
namespace Bit.Core.Models
|
||||
@ -24,8 +24,13 @@ namespace Bit.Core.Models
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Handle newtonsoft parsing
|
||||
Descriptor = JsonHelpers.LegacyDeserialize<PublicKeyCredentialDescriptor>(o.Descriptor.ToString());
|
||||
// Fallback for older newtonsoft serialized tokens.
|
||||
if (o.Descriptor.Type == 0)
|
||||
{
|
||||
o.Descriptor.Type = "public-key";
|
||||
}
|
||||
Descriptor = JsonSerializer.Deserialize<PublicKeyCredentialDescriptor>(o.Descriptor.ToString(),
|
||||
new JsonSerializerOptions { PropertyNameCaseInsensitive = true });
|
||||
}
|
||||
PublicKey = o.PublicKey;
|
||||
UserHandle = o.UserHandle;
|
||||
|
Reference in New Issue
Block a user