Skip to content

Commit 6acebde

Browse files
authored
Merge pull request #252 from DuendeSoftware/mb/passkeys
.NET 10 ASP.NET Identity passkeys sample
2 parents 7b59338 + f0709e6 commit 6acebde

File tree

146 files changed

+60290
-4
lines changed

Some content is hidden

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

146 files changed

+60290
-4
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,21 @@ jobs:
3636
steps:
3737
- name: Checkout repository
3838
uses: actions/checkout@v4
39-
39+
4040
- name: Setup Dotnet
4141
uses: actions/setup-dotnet@3e891b0cb619bf60e2c25674b222b8940e2c1c25
4242
with:
4343
dotnet-version: |-
4444
6.0.x
4545
8.0.x
4646
9.0.103
47+
10.0.x
4748
4849
- run: dotnet --list-sdks
4950

5051
- name: Install .NET Aspire workload
5152
run: dotnet workload install aspire
52-
53+
5354
# Initializes the CodeQL tools for scanning.
5455
- name: Initialize CodeQL
5556
uses: github/codeql-action/init@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0
@@ -61,6 +62,6 @@ jobs:
6162
# queries: ./path/to/local/query, your-org/your-repo/queries@main
6263

6364
- run: ./build.sh build
64-
65+
6566
- name: Perform CodeQL Analysis
6667
uses: github/codeql-action/analyze@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"dotnet-ef": {
6+
"version": "10.0.0-preview.7.25380.108",
7+
"commands": [
8+
"dotnet-ef"
9+
],
10+
"rollForward": false
11+
}
12+
}
13+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
bin/
2+
obj/
3+
/packages/
4+
riderModule.iml
5+
/_ReSharper.Caches/
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IdentityServerAspNetIdentityPasskeys", "IdentityServerAspNetIdentityPasskeys\IdentityServerAspNetIdentityPasskeys.csproj", "{BFF3D2A2-391A-477F-81DE-9A2ED321C41C}"
4+
EndProject
5+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_", "_", "{0BF13ED9-61A5-4DAC-9E47-E2D0372F8DF6}"
6+
ProjectSection(SolutionItems) = preProject
7+
global.json = global.json
8+
EndProjectSection
9+
EndProject
10+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".config", ".config", "{2D99DC4E-FF98-48C7-B897-E4C6F0CE42A0}"
11+
ProjectSection(SolutionItems) = preProject
12+
dotnet-tools.json = .config/dotnet-tools.json
13+
EndProjectSection
14+
EndProject
15+
Global
16+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
17+
Debug|Any CPU = Debug|Any CPU
18+
Release|Any CPU = Release|Any CPU
19+
EndGlobalSection
20+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
21+
{BFF3D2A2-391A-477F-81DE-9A2ED321C41C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
22+
{BFF3D2A2-391A-477F-81DE-9A2ED321C41C}.Debug|Any CPU.Build.0 = Debug|Any CPU
23+
{BFF3D2A2-391A-477F-81DE-9A2ED321C41C}.Release|Any CPU.ActiveCfg = Release|Any CPU
24+
{BFF3D2A2-391A-477F-81DE-9A2ED321C41C}.Release|Any CPU.Build.0 = Release|Any CPU
25+
EndGlobalSection
26+
GlobalSection(NestedProjects) = preSolution
27+
{2D99DC4E-FF98-48C7-B897-E4C6F0CE42A0} = {0BF13ED9-61A5-4DAC-9E47-E2D0372F8DF6}
28+
EndGlobalSection
29+
EndGlobal
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Copyright (c) Duende Software. All rights reserved.
2+
// Licensed under the MIT License. See LICENSE in the project root for license information.
3+
4+
using Duende.IdentityServer.Models;
5+
6+
namespace IdentityServerAspNetIdentityPasskeys;
7+
8+
public static class Config
9+
{
10+
public static IEnumerable<IdentityResource> IdentityResources =>
11+
new IdentityResource[]
12+
{
13+
new IdentityResources.OpenId(),
14+
new IdentityResources.Profile(),
15+
};
16+
17+
public static IEnumerable<ApiScope> ApiScopes =>
18+
new ApiScope[]
19+
{
20+
new ApiScope("scope1"),
21+
new ApiScope("scope2"),
22+
};
23+
24+
public static IEnumerable<Client> Clients =>
25+
new Client[]
26+
{
27+
// m2m client credentials flow client
28+
new Client
29+
{
30+
ClientId = "m2m.client",
31+
ClientName = "Client Credentials Client",
32+
33+
AllowedGrantTypes = GrantTypes.ClientCredentials,
34+
ClientSecrets = { new Secret("511536EF-F270-4058-80CA-1C89C192F69A".Sha256()) },
35+
36+
AllowedScopes = { "scope1" }
37+
},
38+
39+
// interactive client using code flow + pkce
40+
new Client
41+
{
42+
ClientId = "interactive",
43+
ClientSecrets = { new Secret("49C1A7E1-0C79-4A89-A3D6-A37998FB86B0".Sha256()) },
44+
45+
AllowedGrantTypes = GrantTypes.Code,
46+
47+
RedirectUris = { "https://localhost:44300/signin-oidc" },
48+
FrontChannelLogoutUri = "https://localhost:44300/signout-oidc",
49+
PostLogoutRedirectUris = { "https://localhost:44300/signout-callback-oidc" },
50+
51+
AllowOfflineAccess = true,
52+
AllowedScopes = { "openid", "profile", "scope2" }
53+
},
54+
};
55+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright (c) Duende Software. All rights reserved.
2+
// Licensed under the MIT License. See LICENSE in the project root for license information.
3+
4+
using IdentityServerAspNetIdentityPasskeys.Models;
5+
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
6+
using Microsoft.EntityFrameworkCore;
7+
8+
namespace IdentityServerAspNetIdentityPasskeys.Data;
9+
10+
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
11+
{
12+
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
13+
: base(options)
14+
{
15+
}
16+
17+
protected override void OnModelCreating(ModelBuilder builder) =>
18+
base.OnModelCreating(
19+
builder); // Customize the ASP.NET Identity model and override the defaults if needed.// For example, you can rename the ASP.NET Identity table names and more.// Add your customizations after calling base.OnModelCreating(builder);
20+
}

0 commit comments

Comments
 (0)