Skip to content

Commit 82de6f4

Browse files
Add passkeys to ASP.NET Core Identity (#62112)
1 parent 0d5ddb0 commit 82de6f4

File tree

147 files changed

+7186
-185
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+7186
-185
lines changed

AspNetCore.slnx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,8 @@
409409
<Folder Name="/src/Identity/samples/">
410410
<Project Path="src/Identity/samples/IdentitySample.DefaultUI/IdentitySample.DefaultUI.csproj" />
411411
<Project Path="src/Identity/samples/IdentitySample.Mvc/IdentitySample.Mvc.csproj" />
412+
<Project Path="src/Identity/samples/IdentitySample.PasskeyConformance/IdentitySample.PasskeyConformance.csproj" />
413+
<Project Path="src/Identity/samples/IdentitySample.PasskeyUI/IdentitySample.PasskeyUI.csproj" />
412414
</Folder>
413415
<Folder Name="/src/Identity/Specification.Tests/">
414416
<Project Path="src/Identity/Specification.Tests/src/Microsoft.AspNetCore.Identity.Specification.Tests.csproj" />

eng/Dependencies.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ and are generated based on the last package release.
8383
<LatestPackageReference Include="System.Diagnostics.DiagnosticSource" />
8484
<LatestPackageReference Include="System.Diagnostics.EventLog" />
8585
<LatestPackageReference Include="System.DirectoryServices.Protocols" />
86+
<LatestPackageReference Include="System.Formats.Cbor" />
8687
<LatestPackageReference Include="System.IdentityModel.Tokens.Jwt" />
8788
<LatestPackageReference Include="System.IO.Pipelines" />
8889
<LatestPackageReference Include="System.Memory" />

eng/SharedFramework.External.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
<ExternalAspNetCoreAppReference Include="Microsoft.Extensions.Options.DataAnnotations" Version="$(MicrosoftExtensionsOptionsDataAnnotationsVersion)" />
4343
<ExternalAspNetCoreAppReference Include="Microsoft.Extensions.Options" Version="$(MicrosoftExtensionsOptionsVersion)" />
4444
<ExternalAspNetCoreAppReference Include="Microsoft.Extensions.Primitives" Version="$(MicrosoftExtensionsPrimitivesVersion)" />
45+
<ExternalAspNetCoreAppReference Include="System.Formats.Cbor" Version="$(SystemFormatsCborVersion)" />
4546
<ExternalAspNetCoreAppReference Include="System.Security.Cryptography.Xml" Version="$(SystemSecurityCryptographyXmlVersion)" />
4647
<ExternalAspNetCoreAppReference Include="System.Threading.RateLimiting" Version="$(SystemThreadingRateLimitingVersion)" />
4748

eng/Version.Details.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,10 @@
215215
<Uri>https://github.com/dotnet/dotnet</Uri>
216216
<Sha>0785dfdb947fe301da00b7c331d6adfdeda5b283</Sha>
217217
</Dependency>
218+
<Dependency Name="System.Formats.Cbor" Version="10.0.0-preview.7.25324.103">
219+
<Uri>https://github.com/dotnet/dotnet</Uri>
220+
<Sha>005f36cd1953e1308c1882a9d2e1fc1e84e6b2e4</Sha>
221+
</Dependency>
218222
<Dependency Name="System.IO.Pipelines" Version="10.0.0-preview.7.25324.103">
219223
<Uri>https://github.com/dotnet/dotnet</Uri>
220224
<Sha>0785dfdb947fe301da00b7c331d6adfdeda5b283</Sha>

eng/Versions.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
<SystemDiagnosticsEventLogVersion>10.0.0-preview.7.25324.103</SystemDiagnosticsEventLogVersion>
117117
<SystemDirectoryServicesProtocolsVersion>10.0.0-preview.7.25324.103</SystemDirectoryServicesProtocolsVersion>
118118
<SystemFormatsAsn1Version>10.0.0-preview.7.25324.103</SystemFormatsAsn1Version>
119+
<SystemFormatsCborVersion>10.0.0-preview.7.25324.103</SystemFormatsCborVersion>
119120
<SystemIOPipelinesVersion>10.0.0-preview.7.25324.103</SystemIOPipelinesVersion>
120121
<SystemNetHttpJsonVersion>10.0.0-preview.7.25324.103</SystemNetHttpJsonVersion>
121122
<SystemNetHttpWinHttpHandlerVersion>10.0.0-preview.7.25324.103</SystemNetHttpWinHttpHandlerVersion>

eng/common/build.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Param(
3737
# Unset 'Platform' environment variable to avoid unwanted collision in InstallDotNetCore.targets file
3838
# some computer has this env var defined (e.g. Some HP)
3939
if($env:Platform) {
40-
$env:Platform=""
40+
$env:Platform=""
4141
}
4242
function Print-Usage() {
4343
Write-Host "Common settings:"
@@ -108,10 +108,10 @@ function Build {
108108
# Re-assign properties to a new variable because PowerShell doesn't let us append properties directly for unclear reasons.
109109
# Explicitly set the type as string[] because otherwise PowerShell would make this char[] if $properties is empty.
110110
[string[]] $msbuildArgs = $properties
111-
112-
# Resolve relative project paths into full paths
111+
112+
# Resolve relative project paths into full paths
113113
$projects = ($projects.Split(';').ForEach({Resolve-Path $_}) -join ';')
114-
114+
115115
$msbuildArgs += "/p:Projects=$projects"
116116
$properties = $msbuildArgs
117117
}

eng/tools/GenerateFiles/Directory.Build.targets.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,14 @@
133133
</ItemGroup>
134134

135135
<!-- When building and running locally, manually resolve the just-built frameworks. On Helix, let the SDK resolve the packs itself (they're laid out on top of the .NET SDK in the work items) -->
136-
<PropertyGroup Condition="$(UpdateAspNetCoreKnownFramework) and '$(HELIX_CORRELATION_PAYLOAD)' == ''">
136+
<PropertyGroup Condition="'$(UpdateAspNetCoreKnownFramework)' == 'true' AND '$(HELIX_CORRELATION_PAYLOAD)' == ''">
137137
<!-- Allow additional targeting and runtime packs to be downloaded only if required by a test. -->
138138
<EnableTargetingPackDownload Condition="'$(TestRequiresTargetingPackDownload)' != 'true'">false</EnableTargetingPackDownload>
139139
<EnableRuntimePackDownload Condition="'$(TestRequiresRuntimePackDownload)' != 'true'">false</EnableRuntimePackDownload>
140140
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>
141141
</PropertyGroup>
142142

143-
<Target Name="ResolveLiveBuiltAspnetCoreKnownFramework" Condition="$(UpdateAspNetCoreKnownFramework) and '$(HELIX_CORRELATION_PAYLOAD)' == ''" AfterTargets="ResolveFrameworkReferences">
143+
<Target Name="ResolveLiveBuiltAspnetCoreKnownFramework" Condition="'$(UpdateAspNetCoreKnownFramework)' == 'true' AND '$(HELIX_CORRELATION_PAYLOAD)' == ''" AfterTargets="ResolveFrameworkReferences">
144144
<Error Text="Requested Microsoft.AspNetCore.App v${MicrosoftAspNetCoreAppRefVersion} ref pack does not exist."
145145
Condition="!Exists('$(TargetingPackLayoutRoot)packs\Microsoft.AspNetCore.App.Ref\${MicrosoftAspNetCoreAppRefVersion}\data\FrameworkList.xml') " />
146146
<ItemGroup>

src/Components/ComponentsNoDeps.slnf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,4 @@
6262
"src\\Components\\test\\testassets\\TestContentPackage\\TestContentPackage.csproj"
6363
]
6464
}
65-
}
65+
}

src/Framework/test/TestData.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ static TestData()
156156
"Microsoft.Net.Http.Headers",
157157
"System.Diagnostics.EventLog",
158158
"System.Diagnostics.EventLog.Messages",
159+
"System.Formats.Cbor",
159160
"System.Security.Cryptography.Pkcs",
160161
"System.Security.Cryptography.Xml",
161162
"System.Threading.RateLimiting",
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
namespace Microsoft.AspNetCore.Identity;
5+
6+
/// <summary>
7+
/// Used to specify requirements regarding authenticator attributes.
8+
/// </summary>
9+
/// <remarks>
10+
/// See <see href="https://www.w3.org/TR/webauthn-3/#dictdef-authenticatorselectioncriteria"/>.
11+
/// </remarks>
12+
public sealed class AuthenticatorSelectionCriteria
13+
{
14+
/// <summary>
15+
/// Gets or sets the authenticator attachment.
16+
/// </summary>
17+
/// <remarks>
18+
/// See <see href="https://www.w3.org/TR/webauthn-3/#dom-authenticatorselectioncriteria-authenticatorattachment"/>.
19+
/// </remarks>
20+
public string? AuthenticatorAttachment { get; set; }
21+
22+
/// <summary>
23+
/// Gets or sets the extent to which the server desires to create a client-side discoverable credential.
24+
/// Supported values are "discouraged", "preferred", or "required".
25+
/// </summary>
26+
/// <remarks>
27+
/// See <see href="https://www.w3.org/TR/webauthn-3/#dom-authenticatorselectioncriteria-residentkey"/>
28+
/// </remarks>
29+
public string? ResidentKey { get; set; }
30+
31+
/// <summary>
32+
/// Gets whether a resident key is required.
33+
/// </summary>
34+
/// <remarks>
35+
/// See <see href="https://www.w3.org/TR/webauthn-3/#dom-authenticatorselectioncriteria-requireresidentkey"/>.
36+
/// </remarks>
37+
public bool RequireResidentKey => string.Equals("required", ResidentKey, StringComparison.Ordinal);
38+
39+
/// <summary>
40+
/// Gets or sets the user verification requirement.
41+
/// </summary>
42+
/// <remarks>
43+
/// See <see href="https://www.w3.org/TR/webauthn-3/#dom-authenticatorselectioncriteria-userverification"/>.
44+
/// </remarks>
45+
public string UserVerification { get; set; } = "preferred";
46+
}

0 commit comments

Comments
 (0)