Repository navigation
Infer passkey display name from AAGUID #65343
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e6e227a
Add `Aaguid` property to `UserPasskeyInfo` and `IdentityPasskeyData`
MackinnonBuck 9a54cfc
Update Blazor Web App template UI
MackinnonBuck f02f7c4
Display passkey creation date in UTC
MackinnonBuck 1d38d09
Don't update the AAGUID after passkey creation
MackinnonBuck f4f8610
Only update passkey once
MackinnonBuck e929514
Fix typo in comment for UpdateFromUserPasskeyInfo
MackinnonBuck 30a5258
Update test baselines
MackinnonBuck File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1 +1,3 @@ | ||
| #nullable enable | ||
| Microsoft.AspNetCore.Identity.UserPasskeyInfo.Aaguid.get -> byte[]? | ||
| Microsoft.AspNetCore.Identity.UserPasskeyInfo.Aaguid.set -> void |
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1 +1,3 @@ | ||
| #nullable enable | ||
| virtual Microsoft.AspNetCore.Identity.IdentityPasskeyData.Aaguid.get -> byte[]? | ||
| virtual Microsoft.AspNetCore.Identity.IdentityPasskeyData.Aaguid.set -> void |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
62 changes: 62 additions & 0 deletions
62
...es/content/BlazorWeb-CSharp/BlazorWebCSharp.1/Components/Account/PasskeyAuthenticators.cs
This file contains hidden or 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,62 @@ | ||
| using System.Diagnostics.CodeAnalysis; | ||
| using Microsoft.AspNetCore.Identity; | ||
|
|
||
| namespace BlazorWebCSharp._1.Components.Account; | ||
|
|
||
| // Maps passkey AAGUIDs to authenticator names. | ||
| // The AAGUID data is sourced from the community-maintained list at | ||
| // https://github.com/passkeydeveloper/passkey-authenticator-aaguids. | ||
| // You can add or modify authenticators as needed. | ||
| public static class PasskeyAuthenticators | ||
| { | ||
| private static readonly Dictionary<Guid, string> KnownAuthenticators = new() | ||
| { | ||
| // Google Password Manager | ||
| [new("ea9b8d66-4d01-1d21-3ce4-b6b48cb575d4")] = "Google Password Manager", | ||
|
|
||
| // Apple iCloud Keychain | ||
| [new("fbfc3007-154e-4ecc-8c0b-6e020557d7bd")] = "iCloud Keychain", | ||
| [new("dd4ec289-e01d-41c9-bb89-70fa845d4bf2")] = "iCloud Keychain", | ||
|
|
||
| // Microsoft Windows Hello | ||
| [new("08987058-cadc-4b81-b6e1-30de50dcbe96")] = "Windows Hello", | ||
| [new("9ddd1817-af5a-4672-a2b9-3e3dd95000a9")] = "Windows Hello", | ||
| [new("6028b017-b1d4-4c02-b4b3-afcdafc96bb2")] = "Windows Hello", | ||
|
|
||
| // 1Password | ||
| [new("bada5566-a7aa-401f-bd96-45619a55120d")] = "1Password", | ||
| [new("b5397571-8af2-4d30-9d48-eeb8eee6e9c6")] = "1Password", | ||
|
|
||
| // Bitwarden | ||
| [new("d548826e-79b4-db40-a3d8-11116f7e8349")] = "Bitwarden", | ||
| [new("cc45f64e-52a2-451b-831a-4edd8022a202")] = "Bitwarden", | ||
| }; | ||
|
|
||
| public static bool TryGetDefaultDisplayName(UserPasskeyInfo passkey, [NotNullWhen(true)] out string? defaultName) | ||
| { | ||
| if (passkey.Aaguid is { Length: 16 } aaguid && | ||
| KnownAuthenticators.TryGetValue(new Guid(aaguid, bigEndian: true), out var name)) | ||
| { | ||
| defaultName = name; | ||
| return true; | ||
| } | ||
|
|
||
| defaultName = null; | ||
| return false; | ||
| } | ||
|
|
||
| public static string GetDisplayName(UserPasskeyInfo passkey) | ||
| { | ||
| if (!string.IsNullOrEmpty(passkey.Name)) | ||
| { | ||
| return passkey.Name; | ||
| } | ||
|
|
||
| if (TryGetDefaultDisplayName(passkey, out var name)) | ||
| { | ||
| return name; | ||
| } | ||
|
|
||
| return "Unnamed passkey"; | ||
| } | ||
| } | ||
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.