Skip to content

Commit 54761b0

Browse files
authored
Add .Net 6 as supported framework (#270)
* Add .Net6 to the Demo project * Add .Net6 to the Test project * Add net6.0 to the SupportedTargetFrameworks * Add .Net6 to the Fido2.AspNet project * Fix BOM typo in the AuthenticatorAssertionResponse * Specify RootNamespace (maybe use separate namespace for each project?) * Resolve compiler warnings in the Test project * Semi-resolve warnings in the Fido2.Model project * Resolve compiler warnings in the Demo project * Resolve warnings in the Fido2 project * Add missing TreatWarningsAsErrors * Fix possible error * Add dotnet-reportgenerator-globaltool (a local package of tool used in CI) * Use coverlet.collector instead of coverlet.msbuild (VSTest issues) * Allow both .Net 5.0 & 6.0, refactor build/test pipeline
1 parent cf0dd8a commit 54761b0

17 files changed

+143
-68
lines changed

Demo/.config/dotnet-tools.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"dotnet-aspnet-codegenerator": {
6+
"version": "6.0.0",
7+
"commands": [
8+
"dotnet-aspnet-codegenerator"
9+
]
10+
}
11+
}
12+
}

Demo/Demo.csproj

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<PropertyGroup>
3-
<TargetFramework>net5.0</TargetFramework>
3+
<TargetFrameworks>net5.0;net6.0</TargetFrameworks>
44
<UserSecretsId>39589262-6aa1-4bde-aaa9-403a7542cf63</UserSecretsId>
5+
<RootNamespace>Fido2Demo</RootNamespace>
56
</PropertyGroup>
67
<ItemGroup>
78
<ProjectReference Include="..\Src\Fido2.AspNet\Fido2.AspNet.csproj" />
89
<ProjectReference Include="..\Src\Fido2.Models\Fido2.Models.csproj" />
910
<ProjectReference Include="..\Src\Fido2\Fido2.csproj" />
10-
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.2" />
1111
</ItemGroup>
12-
<ItemGroup>
13-
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.2" />
12+
<ItemGroup Condition=" '$(TargetFramework)' == 'net5.0' ">
13+
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.2" />
14+
</ItemGroup>
15+
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
16+
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.0" />
1417
</ItemGroup>
1518
<ItemGroup>
1619
<Folder Include="wwwroot\bulma\" />

Demo/Pages/custom.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
</div>
7373

7474
<partial name="_options.cshtml" />
75-
@Html.Partial("_options.cshtml")
75+
@await Html.PartialAsync("_options.cshtml")
7676

7777
<div class="section">
7878
<div class="container">

Directory.Build.props

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515

1616
<!-- Global Variables -->
1717
<PropertyGroup>
18-
<SupportedTargetFrameworks>net5.0</SupportedTargetFrameworks>
18+
<SupportedTargetFrameworks>net5.0;net6.0</SupportedTargetFrameworks>
19+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
1920
</PropertyGroup>
2021

2122
<!-- Language + Compiler Settings-->
@@ -30,4 +31,4 @@
3031
<!-- Avoid annoying build warnings when packing using the solution file -->
3132
<IsTestProject>false</IsTestProject>
3233
</PropertyGroup>
33-
</Project>
34+
</Project>

Src/Fido2.AspNet/Fido2.AspNet.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net5.0</TargetFrameworks>
4+
<TargetFrameworks>net5.0;net6.0</TargetFrameworks>
5+
<RootNamespace>Fido2NetLib</RootNamespace>
56
</PropertyGroup>
67

78
<ItemGroup>

Src/Fido2.Models/Fido2.Models.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
<PropertyGroup>
33
<TargetFrameworks>$(SupportedTargetFrameworks)</TargetFrameworks>
44
<GenerateDocumentationFile>true</GenerateDocumentationFile>
5+
<RootNamespace>Fido2NetLib</RootNamespace>
6+
<NoWarn>$(NoWarn);CS1591</NoWarn>
57
</PropertyGroup>
68

79
<ItemGroup>
@@ -17,4 +19,4 @@
1719
<ItemGroup>
1820
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="1.0.0" />
1921
</ItemGroup>
20-
</Project>
22+
</Project>

Src/Fido2.Models/Fido2Configuration.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ public class Fido2Configuration
4848
/// </summary>
4949
public HashSet<string> Origins
5050
{
51-
get => _origins ?? new HashSet<string> { Origin };
51+
get => _origins ?? new HashSet<string>
52+
{
53+
#pragma warning disable CS0618
54+
Origin
55+
#pragma warning restore CS0618
56+
};
5257
set
5358
{
5459
_origins = value;
@@ -61,7 +66,12 @@ public HashSet<string> Origins
6166
/// </summary>
6267
public HashSet<string> FullyQualifiedOrigins
6368
{
64-
get => _fullyQualifiedOrigins ?? new HashSet<string> { Origin?.ToFullyQualifiedOrigin() };
69+
get => _fullyQualifiedOrigins ?? new HashSet<string>
70+
{
71+
#pragma warning disable CS0618
72+
Origin?.ToFullyQualifiedOrigin()
73+
#pragma warning restore CS0618
74+
};
6575
private set => _fullyQualifiedOrigins = value;
6676
}
6777

Src/Fido2/AttestationFormat/AndroidSafetyNet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace Fido2NetLib
1616
{
1717
internal sealed class AndroidSafetyNet : AttestationVerifier
1818
{
19-
private readonly int _driftTolerance;
19+
private const int _driftTolerance = 0;
2020

2121
private static X509Certificate2 GetX509Certificate(string certString)
2222
{

Src/Fido2/AuthenticatorAssertionResponse.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33

4-
#nullable disable
4+
#nullable disable
55

66
using System.Linq;
77
using System.Security.Cryptography;

Src/Fido2/Cbor/CborMap.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,10 @@ public CborObject GetValue(long key)
166166
throw new KeyNotFoundException($"Key '{key}' not found");
167167
}
168168

169+
169170
public CborObject? this[CborObject key]
170171
{
172+
#pragma warning disable CS8766
171173
get
172174
{
173175
foreach (var item in items)
@@ -178,8 +180,9 @@ public CborObject? this[CborObject key]
178180
}
179181
}
180182

181-
return null!;
183+
return null;
182184
}
185+
#pragma warning restore CS8766
183186
}
184187

185188
public override CborObject? this[string name]

0 commit comments

Comments
 (0)