Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
var builder = DistributedApplication.CreateBuilder(args);

var idp = builder.AddProject<Projects.IdentityServerAspNetIdentityPasskeys>("identityserver");

idp.WithCommand(
name: "seed",
displayName: "Seed Database",
executeCommand: async (context) =>
{
var projectMetadata = idp.Resource.GetProjectMetadata();
var projectPath = projectMetadata.ProjectPath;
var process = new System.Diagnostics.Process
{
StartInfo = new System.Diagnostics.ProcessStartInfo
{
FileName = "dotnet",
Arguments = $"run --project \"{projectPath}\" --no-build -- /seed",
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
CreateNoWindow = true
}
};

process.Start();
await process.WaitForExitAsync(context.CancellationToken);

if (process.ExitCode == 0)
{
return CommandResults.Success();
}
else
{
var error = await process.StandardError.ReadToEndAsync();
return CommandResults.Failure(error);
}
},
commandOptions: new CommandOptions
{
IconName = "DatabaseArrowUp",
IsHighlighted = true
});

builder.AddProject<Projects.Client>("client")
.WaitFor(idp);

builder.Build().Run();
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Aspire.AppHost.Sdk/13.2.2">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Aspire.Hosting.AppHost" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\IdentityServerAspNetIdentityPasskeys\IdentityServerAspNetIdentityPasskeys.csproj" />
<ProjectReference Include="..\Client\Client.csproj" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:15237",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:21137",
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:22137"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:17237;http://localhost:15237",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"DOTNET_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21137",
"DOTNET_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22137"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning",
"Aspire.Hosting.DistributedApplication": "Information"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning",
"Aspire.Hosting.DistributedApplication": "Information"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,76 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_", "_", "{0BF13ED9-61A5-4D
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".config", ".config", "{2D99DC4E-FF98-48C7-B897-E4C6F0CE42A0}"
ProjectSection(SolutionItems) = preProject
dotnet-tools.json = .config/dotnet-tools.json
dotnet-tools.json = dotnet-tools.json
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client", "Client\Client.csproj", "{2C00CA4C-C6DD-47D9-878F-82A825B5CAF3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aspire.ServiceDefaults", "..\Aspire.ServiceDefaults\Aspire.ServiceDefaults.csproj", "{7933C9B2-E155-4892-B375-2A3E7036E502}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AspNetIdentityPasskeys.AppHost", "AspNetIdentityPasskeys.AppHost\AspNetIdentityPasskeys.AppHost.csproj", "{C01F5EE2-1B42-4320-A830-783C44DFA5A1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BFF3D2A2-391A-477F-81DE-9A2ED321C41C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BFF3D2A2-391A-477F-81DE-9A2ED321C41C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BFF3D2A2-391A-477F-81DE-9A2ED321C41C}.Debug|x64.ActiveCfg = Debug|Any CPU
{BFF3D2A2-391A-477F-81DE-9A2ED321C41C}.Debug|x64.Build.0 = Debug|Any CPU
{BFF3D2A2-391A-477F-81DE-9A2ED321C41C}.Debug|x86.ActiveCfg = Debug|Any CPU
{BFF3D2A2-391A-477F-81DE-9A2ED321C41C}.Debug|x86.Build.0 = Debug|Any CPU
{BFF3D2A2-391A-477F-81DE-9A2ED321C41C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BFF3D2A2-391A-477F-81DE-9A2ED321C41C}.Release|Any CPU.Build.0 = Release|Any CPU
{BFF3D2A2-391A-477F-81DE-9A2ED321C41C}.Release|x64.ActiveCfg = Release|Any CPU
{BFF3D2A2-391A-477F-81DE-9A2ED321C41C}.Release|x64.Build.0 = Release|Any CPU
{BFF3D2A2-391A-477F-81DE-9A2ED321C41C}.Release|x86.ActiveCfg = Release|Any CPU
{BFF3D2A2-391A-477F-81DE-9A2ED321C41C}.Release|x86.Build.0 = Release|Any CPU
{2C00CA4C-C6DD-47D9-878F-82A825B5CAF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2C00CA4C-C6DD-47D9-878F-82A825B5CAF3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2C00CA4C-C6DD-47D9-878F-82A825B5CAF3}.Debug|x64.ActiveCfg = Debug|Any CPU
{2C00CA4C-C6DD-47D9-878F-82A825B5CAF3}.Debug|x64.Build.0 = Debug|Any CPU
{2C00CA4C-C6DD-47D9-878F-82A825B5CAF3}.Debug|x86.ActiveCfg = Debug|Any CPU
{2C00CA4C-C6DD-47D9-878F-82A825B5CAF3}.Debug|x86.Build.0 = Debug|Any CPU
{2C00CA4C-C6DD-47D9-878F-82A825B5CAF3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2C00CA4C-C6DD-47D9-878F-82A825B5CAF3}.Release|Any CPU.Build.0 = Release|Any CPU
{2C00CA4C-C6DD-47D9-878F-82A825B5CAF3}.Release|x64.ActiveCfg = Release|Any CPU
{2C00CA4C-C6DD-47D9-878F-82A825B5CAF3}.Release|x64.Build.0 = Release|Any CPU
{2C00CA4C-C6DD-47D9-878F-82A825B5CAF3}.Release|x86.ActiveCfg = Release|Any CPU
{2C00CA4C-C6DD-47D9-878F-82A825B5CAF3}.Release|x86.Build.0 = Release|Any CPU
{7933C9B2-E155-4892-B375-2A3E7036E502}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7933C9B2-E155-4892-B375-2A3E7036E502}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7933C9B2-E155-4892-B375-2A3E7036E502}.Debug|x64.ActiveCfg = Debug|Any CPU
{7933C9B2-E155-4892-B375-2A3E7036E502}.Debug|x64.Build.0 = Debug|Any CPU
{7933C9B2-E155-4892-B375-2A3E7036E502}.Debug|x86.ActiveCfg = Debug|Any CPU
{7933C9B2-E155-4892-B375-2A3E7036E502}.Debug|x86.Build.0 = Debug|Any CPU
{7933C9B2-E155-4892-B375-2A3E7036E502}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7933C9B2-E155-4892-B375-2A3E7036E502}.Release|Any CPU.Build.0 = Release|Any CPU
{7933C9B2-E155-4892-B375-2A3E7036E502}.Release|x64.ActiveCfg = Release|Any CPU
{7933C9B2-E155-4892-B375-2A3E7036E502}.Release|x64.Build.0 = Release|Any CPU
{7933C9B2-E155-4892-B375-2A3E7036E502}.Release|x86.ActiveCfg = Release|Any CPU
{7933C9B2-E155-4892-B375-2A3E7036E502}.Release|x86.Build.0 = Release|Any CPU
{C01F5EE2-1B42-4320-A830-783C44DFA5A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C01F5EE2-1B42-4320-A830-783C44DFA5A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C01F5EE2-1B42-4320-A830-783C44DFA5A1}.Debug|x64.ActiveCfg = Debug|Any CPU
{C01F5EE2-1B42-4320-A830-783C44DFA5A1}.Debug|x64.Build.0 = Debug|Any CPU
{C01F5EE2-1B42-4320-A830-783C44DFA5A1}.Debug|x86.ActiveCfg = Debug|Any CPU
{C01F5EE2-1B42-4320-A830-783C44DFA5A1}.Debug|x86.Build.0 = Debug|Any CPU
{C01F5EE2-1B42-4320-A830-783C44DFA5A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C01F5EE2-1B42-4320-A830-783C44DFA5A1}.Release|Any CPU.Build.0 = Release|Any CPU
{C01F5EE2-1B42-4320-A830-783C44DFA5A1}.Release|x64.ActiveCfg = Release|Any CPU
{C01F5EE2-1B42-4320-A830-783C44DFA5A1}.Release|x64.Build.0 = Release|Any CPU
{C01F5EE2-1B42-4320-A830-783C44DFA5A1}.Release|x86.ActiveCfg = Release|Any CPU
{C01F5EE2-1B42-4320-A830-783C44DFA5A1}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{2D99DC4E-FF98-48C7-B897-E4C6F0CE42A0} = {0BF13ED9-61A5-4DAC-9E47-E2D0372F8DF6}
Expand Down
16 changes: 16 additions & 0 deletions IdentityServer/v7/AspNetIdentityPasskeys/Client/Client.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>true</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\Aspire.ServiceDefaults\Aspire.ServiceDefaults.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" />
</ItemGroup>

</Project>
26 changes: 26 additions & 0 deletions IdentityServer/v7/AspNetIdentityPasskeys/Client/Pages/Error.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
@page
@model ErrorModel
@{
ViewData["Title"] = "Error";
}

<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>

@if (Model.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}

<h3>Development Mode</h3>
<p>
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright (c) Duende Software. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace Client.Pages;

[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
[IgnoreAntiforgeryToken]
public class ErrorModel : PageModel
{
public string RequestId { get; set; }

public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);

private readonly ILogger<ErrorModel> _logger;

public ErrorModel(ILogger<ErrorModel> logger)
{
_logger = logger;
}

public void OnGet()
{
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}
}
11 changes: 11 additions & 0 deletions IdentityServer/v7/AspNetIdentityPasskeys/Client/Pages/Index.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@page
@model IndexModel
@{
ViewData["Title"] = "Home page";
}

<div class="text-center">
<h1 class="display-4">Welcome</h1>
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
</div>

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright (c) Duende Software. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace Client.Pages;

public class IndexModel : PageModel
{
private readonly ILogger<IndexModel> _logger;

public IndexModel(ILogger<IndexModel> logger)
{
_logger = logger;
}

public void OnGet()
{

}

public IActionResult OnPost()
{
return SignOut("cookies", "oidc");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@page
@model SecureModel

<h2>Claims</h2>
<dl>
@foreach(var claim in User.Claims)
{
<dt>@claim.Type</dt>
<dd>@claim.Value</dd>
}
</dl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (c) Duende Software. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace Client.Pages;

[Authorize]
public class SecureModel : PageModel
{
private readonly ILogger<SecureModel> _logger;

public SecureModel(ILogger<SecureModel> logger)
{
_logger = logger;
}

public void OnGet()
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - Client</title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" />
</head>
<body>
<header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
<div class="container">
<a class="navbar-brand" asp-area="" asp-page="/Index">Client</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
<ul class="navbar-nav flex-grow-1">
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-page="/Index">Home</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-page="/Secure">Secure</a>
</li>

<li class="nav-item">
<form class="form-inline" method="post" asp-page="Index">
<button type="submit" class="nav-link btn btn-link text-dark">Logout</button>
</form>
</li>

</ul>
</div>
</div>
</nav>
</header>
<div class="container">
<main role="main" class="pb-3">
@RenderBody()
</main>
</div>

<footer class="border-top footer text-muted">
<div class="container">
&copy; 2021 - Client
</div>
</footer>

<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>

@await RenderSectionAsync("Scripts", required: false)
</body>
</html>
Loading
Loading