-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Progress on implementing signture validation in server.
- Loading branch information
1 parent
4e664b3
commit 066897b
Showing
13 changed files
with
185 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...ferStrube.Blazor.WebAuthentication/Converters/AttestationConveyancePreferenceConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace KristofferStrube.Blazor.WebAuthentication.Converters; | ||
|
||
public class AttestationConveyancePreferenceConverter : JsonConverter<AttestationConveyancePreference> | ||
{ | ||
public override AttestationConveyancePreference Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) | ||
{ | ||
return reader.GetString() switch | ||
{ | ||
"none" => AttestationConveyancePreference.None, | ||
"indirect" => AttestationConveyancePreference.Indirect, | ||
"direct" => AttestationConveyancePreference.Direct, | ||
"enterprise" => AttestationConveyancePreference.Enterprise, | ||
var value => throw new ArgumentException($"Value '{value}' was not a valid {nameof(PublicKeyCredentialType)}.") | ||
}; | ||
} | ||
|
||
public override void Write(Utf8JsonWriter writer, AttestationConveyancePreference value, JsonSerializerOptions options) | ||
{ | ||
writer.WriteStringValue(value switch | ||
{ | ||
AttestationConveyancePreference.None => "none", | ||
AttestationConveyancePreference.Indirect => "indirect", | ||
AttestationConveyancePreference.Direct => "direct", | ||
AttestationConveyancePreference.Enterprise => "enterprise", | ||
_ => throw new ArgumentException($"Value '{value}' was not a valid {nameof(PublicKeyCredentialType)}.") | ||
}); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/KristofferStrube.Blazor.WebAuthentication/Converters/AuthenticatorTransportConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace KristofferStrube.Blazor.WebAuthentication.Converters; | ||
|
||
public class AuthenticatorTransportConverter : JsonConverter<AuthenticatorTransport> | ||
{ | ||
public override AuthenticatorTransport Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) | ||
{ | ||
return reader.GetString() switch | ||
{ | ||
"usb" => AuthenticatorTransport.Usb, | ||
"nfc" => AuthenticatorTransport.Nfc, | ||
"ble" => AuthenticatorTransport.Ble, | ||
"internal" => AuthenticatorTransport.Internal, | ||
var value => throw new ArgumentException($"Value '{value}' was not a valid {nameof(PublicKeyCredentialType)}.") | ||
}; | ||
} | ||
|
||
public override void Write(Utf8JsonWriter writer, AuthenticatorTransport value, JsonSerializerOptions options) | ||
{ | ||
writer.WriteStringValue(value switch | ||
{ | ||
AuthenticatorTransport.Usb => "usb", | ||
AuthenticatorTransport.Nfc => "nfc", | ||
AuthenticatorTransport.Ble => "ble", | ||
AuthenticatorTransport.Internal => "internal", | ||
_ => throw new ArgumentException($"Value '{value}' was not a valid {nameof(PublicKeyCredentialType)}.") | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/KristofferStrube.Blazor.WebAuthentication/Options/AttestationConveyancePreference.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using KristofferStrube.Blazor.WebAuthentication.Converters; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace KristofferStrube.Blazor.WebAuthentication; | ||
|
||
[JsonConverter(typeof(AttestationConveyancePreferenceConverter))] | ||
public enum AttestationConveyancePreference | ||
{ | ||
/// <summary> | ||
/// The Relying Party is not interested in authenticator attestation. | ||
/// For example, in order to potentially avoid having to obtain user consent to relay identifying information to the Relying Party, | ||
/// or to save a roundtrip to an Attestation CA or Anonymization CA. | ||
/// If the authenticator generates an attestation statement that is not a self attestation, the client will replace it with a None attestation statement. | ||
/// </summary> | ||
None, | ||
/// <summary> | ||
/// The Relying Party wants to receive a verifiable attestation statement, | ||
/// but allows the client to decide how to obtain such an attestation statement. | ||
/// The client can replace an authenticator-generated attestation statement with one generated by an Anonymization CA, in order to protect the user’s privacy, | ||
/// or to assist Relying Parties with attestation verification in a heterogeneous ecosystem. | ||
/// </summary> | ||
Indirect, | ||
/// <summary> | ||
/// The Relying Party wants to receive the attestation statement as generated by the authenticator. | ||
/// </summary> | ||
Direct, | ||
/// <summary> | ||
/// The Relying Party wants to receive an attestation statement that may include uniquely identifying information. | ||
/// This is intended for controlled deployments within an enterprise where the organization wishes to tie registrations to specific authenticators. | ||
/// User agents will provide such an attestation unless the user agent or authenticator configuration permits it for the requested RP ID. | ||
/// </summary> | ||
Enterprise | ||
} |
6 changes: 5 additions & 1 deletion
6
src/KristofferStrube.Blazor.WebAuthentication/Options/AuthenticatorTransport.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/KristofferStrube.Blazor.WebAuthentication/PackedAttestationFormat.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
namespace KristofferStrube.Blazor.WebAuthentication; | ||
|
||
public class PackedAttestationFormat | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters