Skip to content
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

Add .NET 9, drop .NET 6 support #19

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
8 changes: 4 additions & 4 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET SDK 6.0
- name: Setup .NET SDK 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.425
dotnet-version: 8.0.405
source-url: ${{ secrets.NUGET_SOURCE }}
env:
NUGET_AUTH_TOKEN: ${{ secrets.PACKAGES_TOKEN }}
- name: Setup .NET SDK 8.0
- name: Setup .NET SDK 9.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.402
dotnet-version: 9.0.102
source-url: ${{ secrets.NUGET_SOURCE }}
env:
NUGET_AUTH_TOKEN: ${{ secrets.PACKAGES_TOKEN }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ jobs:
ref: ${{ github.sha }}
- name: Set release version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Setup .NET SDK 6.0
- name: Setup .NET SDK 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.425
dotnet-version: 8.0.405
source-url: ${{ secrets.NUGET_SOURCE }}
env:
NUGET_AUTH_TOKEN: ${{ secrets.PACKAGES_TOKEN }}
- name: Setup .NET SDK 8.0
- name: Setup .NET SDK 9.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.402
dotnet-version: 9.0.102
source-url: ${{ secrets.NUGET_SOURCE }}
env:
NUGET_AUTH_TOKEN: ${{ secrets.PACKAGES_TOKEN }}
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# WebAuthn.Net

A production-ready, easy-to-use, extensible implementation of the [WebAuthn Level 3 standard](https://www.w3.org/TR/2023/WD-webauthn-3-20230927/), passing the [FIDO conformance test](https://fidoalliance.org/certification/functional-certification/conformance/), for the server side of web applications on .NET 6 and .NET 8.
A production-ready, easy-to-use, extensible implementation of the [WebAuthn Level 3 standard](https://www.w3.org/TR/2023/WD-webauthn-3-20230927/), passing the [FIDO conformance test](https://fidoalliance.org/certification/functional-certification/conformance/), for the server side of web applications on .NET 8 and .NET 9.

<a href="https://webauthn.dodo.dev"><img src="https://img.shields.io/badge/Demo-blue"/></a>
<a href="https://www.nuget.org/packages/WebAuthn.Net/"><img src="https://img.shields.io/badge/NuGet-blue"/></a>
Expand Down Expand Up @@ -61,8 +61,8 @@ The documentation for each project is described in its README.md file.

### Required dependencies

- [.NET SDK 6.0.425+](https://dotnet.microsoft.com/en-us/download/dotnet/6.0)
- [.NET SDK 8.0.402+](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)
- [.NET SDK 8.0.405+](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)
- [.NET SDK 9.0.102+](https://dotnet.microsoft.com/en-us/download/dotnet/9.0)

## Tips for Contribution

Expand Down
2 changes: 1 addition & 1 deletion demo/WebAuthn.Net.Demo.FidoConformance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This project contains a demo application designed for passing the [FIDO conforma

These steps need to be performed only if you have not done them before.

1. Install .NET SDK versions [6.0.425+](https://dotnet.microsoft.com/en-us/download/dotnet/6.0) and [8.0.402+](https://dotnet.microsoft.com/en-us/download/dotnet/8.0).
1. Install .NET SDK versions [8.0.405+](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) and [9.0.102+](https://dotnet.microsoft.com/en-us/download/dotnet/9.0).
2. [Trust the ASP.NET Core HTTPS development certificate](https://learn.microsoft.com/en-us/aspnet/core/security/enforcing-ssl?view=aspnetcore-8.0&tabs=visual-studio%2Clinux-ubuntu#trust-the-aspnet-core-https-development-certificate-on-windows-and-macos)

### Starting the FIDO Conformance test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>12</LangVersion>
<NoWarn>$(NoWarn);CA1515;CA1819;CA2007;</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -35,7 +36,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Polly" Version="8.4.2" />
<PackageReference Include="Polly" Version="8.5.2" />
</ItemGroup>

</Project>
2 changes: 2 additions & 0 deletions demo/WebAuthn.Net.Demo.Mvc/ViewModels/Error/ErrorViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using System.Text.Json.Serialization;

#pragma warning disable CA1716
namespace WebAuthn.Net.Demo.Mvc.ViewModels.Error;
#pragma warning restore CA1716

[method: JsonConstructor]
public class ErrorViewModel(string errorMessage, int statusCode, string requestId)
Expand Down
8 changes: 3 additions & 5 deletions demo/WebAuthn.Net.Demo.Mvc/WebAuthn.Net.Demo.Mvc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>12</LangVersion>
<NoWarn>$(NoWarn);CA1515;CA2007</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand All @@ -14,11 +15,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="8.0.0" />
<PackageReference Include="OpenTelemetry.Exporter.Prometheus.AspNetCore" Version="1.7.0-rc.1" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.7.0" />
<PackageReference Include="OpenTelemetry.Exporter.Prometheus.AspNetCore" Version="1.11.0-beta.1" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.11.1" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.402",
"version": "9.0.102",
"rollForward": "latestPatch",
"allowPrerelease": false
}
Expand Down
10 changes: 3 additions & 7 deletions src/WebAuthn.Net.OpenTelemetry/WebAuthn.Net.OpenTelemetry.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
Expand All @@ -25,12 +25,8 @@
<ProjectReference Include="..\WebAuthn.Net\WebAuthn.Net.csproj" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
<PackageReference Include="OpenTelemetry" Version="1.6.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
<PackageReference Include="OpenTelemetry" Version="1.7.0" />
<ItemGroup>
<PackageReference Include="OpenTelemetry" Version="1.11.1" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
Expand Down
10 changes: 3 additions & 7 deletions src/WebAuthn.Net.Storage.MySql/WebAuthn.Net.Storage.MySql.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
Expand All @@ -25,13 +25,9 @@
<ProjectReference Include="..\WebAuthn.Net\WebAuthn.Net.csproj" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
<ItemGroup>
<PackageReference Include="Dapper" Version="2.1.35" />
<PackageReference Include="MySqlConnector" Version="2.2.7" />
<PackageReference Include="MySqlConnector" Version="2.4.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
<PackageReference Include="Dapper" Version="2.1.35" />
<PackageReference Include="MySqlConnector" Version="2.3.7" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
Expand All @@ -25,13 +25,9 @@
<ProjectReference Include="..\WebAuthn.Net\WebAuthn.Net.csproj" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
<ItemGroup>
<PackageReference Include="Dapper" Version="2.1.35" />
<PackageReference Include="Npgsql" Version="7.0.7" />
<PackageReference Include="Npgsql" Version="9.0.2" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
<PackageReference Include="Dapper" Version="2.1.35" />
<PackageReference Include="Npgsql" Version="8.0.4" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
Expand All @@ -23,7 +23,7 @@

<ItemGroup>
<PackageReference Include="Dapper" Version="2.1.35" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.2" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="6.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public AuthenticatorAttestationResponse(
{
foreach (var transport in transports)
{
if (!Enum.IsDefined(typeof(AuthenticatorTransport), transport))
if (!Enum.IsDefined(transport))
{
throw new InvalidEnumArgumentException(nameof(transports), (int) transport, typeof(AuthenticatorTransport));
}
Expand All @@ -82,7 +82,7 @@ public AuthenticatorAttestationResponse(
// publicKeyAlgorithm
if (publicKeyAlgorithm.HasValue)
{
if (!Enum.IsDefined(typeof(CoseAlgorithm), publicKeyAlgorithm.Value))
if (!Enum.IsDefined(publicKeyAlgorithm.Value))
{
throw new InvalidEnumArgumentException(nameof(publicKeyAlgorithm), (int) publicKeyAlgorithm.Value, typeof(CoseAlgorithm));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public RegistrationResponse(
// authenticatorAttachment
if (authenticatorAttachment.HasValue)
{
if (!Enum.IsDefined(typeof(AuthenticatorAttachment), authenticatorAttachment.Value))
if (!Enum.IsDefined(authenticatorAttachment.Value))
{
throw new InvalidEnumArgumentException(nameof(authenticatorAttachment), (int) authenticatorAttachment.Value, typeof(AuthenticatorAttachment));
}
Expand All @@ -110,7 +110,7 @@ public RegistrationResponse(
ClientExtensionResults = clientExtensionResults;

// type
if (!Enum.IsDefined(typeof(PublicKeyCredentialType), type))
if (!Enum.IsDefined(type))
{
throw new InvalidEnumArgumentException(nameof(type), (int) type, typeof(PublicKeyCredentialType));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ public class PublicKeyCredentialParameters
/// <exception cref="InvalidEnumArgumentException"><paramref name="alg" /> contains a value that is not defined in <see cref="CoseAlgorithm" /></exception>
public PublicKeyCredentialParameters(PublicKeyCredentialType type, CoseAlgorithm alg)
{
if (!Enum.IsDefined(typeof(PublicKeyCredentialType), type))
if (!Enum.IsDefined(type))
{
throw new InvalidEnumArgumentException(nameof(type), (int) type, typeof(PublicKeyCredentialType));
}

if (!Enum.IsDefined(typeof(CoseAlgorithm), alg))
if (!Enum.IsDefined(alg))
{
throw new InvalidEnumArgumentException(nameof(alg), (int) alg, typeof(CoseAlgorithm));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public AttestationObject(
byte[]? authData)
{
// fmt
if (!Enum.IsDefined(typeof(AttestationStatementFormat), fmt))
if (!Enum.IsDefined(fmt))
{
throw new InvalidEnumArgumentException(nameof(fmt), (int) fmt, typeof(AttestationStatementFormat));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public virtual Result<AbstractAttestationStatement> Decode(
AttestationStatementFormat attestationStatementFormat)
{
ArgumentNullException.ThrowIfNull(attStmt);
if (!Enum.IsDefined(typeof(AttestationStatementFormat), attestationStatementFormat))
if (!Enum.IsDefined(attestationStatementFormat))
{
throw new InvalidEnumArgumentException(nameof(attestationStatementFormat), (int) attestationStatementFormat, typeof(AttestationStatementFormat));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class AndroidKeyAttestationStatement : AbstractAttestationStatement
public AndroidKeyAttestationStatement(CoseAlgorithm alg, byte[] sig, byte[][] x5C)
{
// alg
if (!Enum.IsDefined(typeof(CoseAlgorithm), alg))
if (!Enum.IsDefined(alg))
{
throw new InvalidEnumArgumentException(nameof(alg), (int) alg, typeof(CoseAlgorithm));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class PackedAttestationStatement : AbstractAttestationStatement
public PackedAttestationStatement(CoseAlgorithm alg, byte[] sig, byte[][]? x5C)
{
// alg
if (!Enum.IsDefined(typeof(CoseAlgorithm), alg))
if (!Enum.IsDefined(alg))
{
throw new InvalidEnumArgumentException(nameof(alg), (int) alg, typeof(CoseAlgorithm));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public TpmAttestationStatement(string ver, CoseAlgorithm alg, byte[][] x5C, byte
Ver = ver;

// alg
if (!Enum.IsDefined(typeof(CoseAlgorithm), alg))
if (!Enum.IsDefined(alg))
{
throw new InvalidEnumArgumentException(nameof(alg), (int) alg, typeof(CoseAlgorithm));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public FidoU2FAttestationTypeResult(
AttestationType attestationType,
UniqueByteArraysCollection attestationRootCertificates)
{
if (!Enum.IsDefined(typeof(AttestationType), attestationType))
if (!Enum.IsDefined(attestationType))
{
throw new InvalidEnumArgumentException(nameof(attestationType), (int) attestationType, typeof(AttestationType));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public FidoPackedAttestationTypeResult(
AttestationType attestationType,
UniqueByteArraysCollection attestationRootCertificates)
{
if (!Enum.IsDefined(typeof(AttestationType), attestationType))
if (!Enum.IsDefined(attestationType))
{
throw new InvalidEnumArgumentException(nameof(attestationType), (int) attestationType, typeof(AttestationType));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ public VerifiedAttestationStatement(
UniqueByteArraysCollection? attestationRootCertificates)
{
// fmt
if (!Enum.IsDefined(typeof(AttestationStatementFormat), fmt))
if (!Enum.IsDefined(fmt))
{
throw new InvalidEnumArgumentException(nameof(fmt), (int) fmt, typeof(AttestationStatementFormat));
}

Fmt = fmt;

// attestationType
if (!Enum.IsDefined(typeof(AttestationType), attestationType))
if (!Enum.IsDefined(attestationType))
{
throw new InvalidEnumArgumentException(nameof(attestationType), (int) attestationType, typeof(AttestationType));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class TokenBinding
/// <exception cref="ArgumentException"><paramref name="id" /> is empty when status is <see cref="TokenBindingStatus.Present" /></exception>
public TokenBinding(TokenBindingStatus status, byte[]? id)
{
if (!Enum.IsDefined(typeof(TokenBindingStatus), status))
if (!Enum.IsDefined(status))
{
throw new InvalidEnumArgumentException(nameof(status), (int) status, typeof(TokenBindingStatus));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,10 @@ public virtual async Task StopAsync(CancellationToken cancellationToken)
{
// Signal cancellation to the executing method
var stoppingCts = StoppingCts;
#if NET6_0
stoppingCts?.Cancel();
#else
if (stoppingCts is not null)
{
await stoppingCts.CancelAsync();
}
#endif
}
finally
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public BiometricStatusReport(
throw new ArgumentException("'modality' must contain a single USER_VERIFY constant, representing biometric modality", nameof(modality));
}

if (!Enum.IsDefined(typeof(UserVerificationMethod), modality))
if (!Enum.IsDefined(modality))
{
throw new ArgumentOutOfRangeException(nameof(modality), "Value should be defined in the UserVerificationMethod enum.");
}
Expand Down
Loading