This is scenario where we just want to use FIDO as the MFA. The user register and logins with their username and password. For demo purposes, we trigger the MFA registering on sign up.
├── IdentityProvider
├── Views
│ ├── _ViewStart.cshtml
│ ├── Home
│ │ ├── Privacy.cshtml
│ │ └── Index.cshtml
│ ├── _ViewImports.cshtml
│ ├── Shared
│ │ ├── Error.cshtml
│ │ ├── _LoginPartial.cshtml
│ │ └── _Layout.cshtml
│ └── Authorization
│ │ ├── Logout.cshtml
│ │ └── Authorize.cshtml
├── Areas
│ └── Identity
│ │ ├── Pages
│ │ ├── Account
│ │ │ ├── _ViewImports.cshtml
│ │ │ ├── Manage
│ │ │ │ ├── _ViewImports.cshtml
│ │ │ │ ├── Fido2Mfa.cshtml.cs
│ │ │ │ ├── Disable2fa.cshtml
│ │ │ │ ├── _ManageNav.cshtml
│ │ │ │ ├── Fido2Mfa.cshtml
│ │ │ │ ├── Disable2fa.cshtml.cs
│ │ │ │ ├── TwoFactorAuthentication.cshtml
│ │ │ │ └── TwoFactorAuthentication.cshtml.cs
│ │ │ ├── LoginFido2Mfa.cshtml.cs
│ │ │ ├── LoginFido2Mfa.cshtml
│ │ │ └── Login.cshtml
│ │ ├── _ViewStart.cshtml
│ │ ├── _ViewImports.cshtml
│ │ └── _ValidationScriptsPartial.cshtml
│ │ └── IdentityHostingStartup.cs
├── wwwroot
│ ├── favicon.ico
│ ├── js
│ │ ├── site.js
│ │ ├── helpers.js
│ │ └── instant.js
│ ├── lib
│ │ ├── jquery-validation-unobtrusive
│ │ │ ├── LICENSE.txt
│ │ │ └── jquery.validate.unobtrusive.min.js
│ │ ├── jquery-validation
│ │ │ └── LICENSE.md
│ │ ├── bootstrap
│ │ │ ├── LICENSE
│ │ │ └── dist
│ │ │ │ └── css
│ │ │ │ └── bootstrap-reboot.min.css
│ │ └── jquery
│ │ │ └── LICENSE.txt
│ ├── css
│ │ └── site.css
│ └── images
│ │ └── securitykey.min.svg
├── Data
│ ├── ApplicationUser.cs
│ └── ApplicationDbContext.cs
├── ViewModels
│ ├── Shared
│ │ └── ErrorViewModel.cs
│ └── Authorization
│ │ └── AuthorizeViewModel.cs
├── Properties
│ └── launchSettings.json
├── Migrations
│ ├── 20251114191547_InitialCreate2.cs
│ ├── 20251114190629_InitialCreate.cs
│ └── 20231222144924_5-0.0.cs
├── Controllers
│ ├── HomeController.cs
│ ├── ResourceController.cs
│ ├── ErrorController.cs
│ └── UserinfoController.cs
├── Helpers
│ ├── AsyncEnumerableExtensions.cs
│ └── FormValueRequiredAttribute.cs
├── appsettings.json
├── Fido2
│ ├── Fido2UserTwoFactorTokenProvider.cs
│ ├── FidoStoredCredential.cs
│ └── Fido2Store.cs
├── Program.cs
├── IdentityProvider.csproj
└── Worker.cs
├── BlazorWebApp
├── wwwroot
│ ├── favicon.png
│ └── app.css
├── Components
│ ├── Pages
│ │ ├── Home.razor
│ │ ├── Counter.razor
│ │ ├── Error.razor
│ │ └── Weather.razor
│ ├── Layout
│ │ ├── RedirectToLogin.razor
│ │ ├── MainLayout.razor
│ │ ├── MainLayout.razor.css
│ │ ├── NavMenu.razor
│ │ └── NavMenu.razor.css
│ ├── _Imports.razor
│ ├── Routes.razor
│ └── App.razor
├── appsettings.Development.json
├── appsettings.json
├── Properties
│ └── launchSettings.json
├── BlazorWebApp.csproj
├── MapLoginLogoutEndpoints.cs
├── SecurityHeadersDefinitions.cs
└── Program.cs
├── Old
├── BlazorServerOidc
│ ├── wwwroot
│ │ ├── .well-known
│ │ │ └── security.txt
│ │ ├── favicon.ico
│ │ └── css
│ │ │ ├── open-iconic
│ │ │ ├── font
│ │ │ │ └── fonts
│ │ │ │ │ ├── open-iconic.eot
│ │ │ │ │ ├── open-iconic.otf
│ │ │ │ │ ├── open-iconic.ttf
│ │ │ │ │ └── open-iconic.woff
│ │ │ ├── ICON-LICENSE
│ │ │ ├── README.md
│ │ │ └── FONT-LICENSE
│ │ │ └── site.css
│ ├── Pages
│ │ ├── Index.razor
│ │ ├── _Host.cshtml
│ │ ├── SignedOut.cshtml.cs
│ │ ├── Counter.razor
│ │ ├── Error.cshtml.cs
│ │ ├── FetchData.razor
│ │ ├── _Layout.cshtml
│ │ ├── Error.cshtml
│ │ └── SignedOut.cshtml
│ ├── appsettings.Development.json
│ ├── Data
│ │ ├── WeatherForecast.cs
│ │ └── WeatherForecastService.cs
│ ├── appsettings.json
│ ├── _Imports.razor
│ ├── Shared
│ │ ├── LoginLogoutMenu.razor
│ │ ├── SurveyPrompt.razor
│ │ ├── MainLayout.razor
│ │ ├── NavMenu.razor.css
│ │ ├── NavMenu.razor
│ │ └── MainLayout.razor.css
│ ├── BlazorServerOidc.csproj
│ ├── Properties
│ │ └── launchSettings.json
│ ├── App.razor
│ ├── SecurityHeadersDefinitions.cs
│ ├── Controllers
│ │ └── AccountController.cs
│ └── Program.cs
└── BlazorWebFromBlazorServerOidc
│ ├── wwwroot
│ ├── .well-known
│ │ └── security.txt
│ ├── favicon.ico
│ └── css
│ │ ├── open-iconic
│ │ ├── font
│ │ │ └── fonts
│ │ │ │ ├── open-iconic.eot
│ │ │ │ ├── open-iconic.otf
│ │ │ │ ├── open-iconic.ttf
│ │ │ │ └── open-iconic.woff
│ │ ├── ICON-LICENSE
│ │ ├── README.md
│ │ └── FONT-LICENSE
│ │ └── site.css
│ ├── Pages
│ ├── Index.razor
│ ├── SignedOut.cshtml.cs
│ ├── Counter.razor
│ ├── Error.cshtml.cs
│ ├── FetchData.razor
│ ├── Error.cshtml
│ └── SignedOut.cshtml
│ ├── appsettings.Development.json
│ ├── Data
│ ├── WeatherForecast.cs
│ └── WeatherForecastService.cs
│ ├── appsettings.json
│ ├── _Imports.razor
│ ├── Layout
│ ├── MainLayout.razor
│ ├── LogInOrOut.razor
│ ├── NavMenu.razor.css
│ ├── NavMenu.razor
│ └── MainLayout.razor.css
│ ├── BlazorWebFromBlazorServerOidc.csproj
│ ├── NonceMiddleware.cs
│ ├── Properties
│ └── launchSettings.json
│ ├── Routes.razor
│ ├── App.razor
│ ├── BlazorNonceService.cs
│ ├── SecurityHeadersDefinitions.cs
│ ├── Controllers
│ └── AccountController.cs
│ └── Program.cs
├── .github
└── workflows
│ └── dotnet.yml
├── LICENSE
├── README.md
└── BlazorServerOidc.sln
/IdentityProvider/Views/_ViewStart.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = "_Layout";
3 | }
4 |
--------------------------------------------------------------------------------
/IdentityProvider/Areas/Identity/Pages/Account/_ViewImports.cshtml:
--------------------------------------------------------------------------------
1 | @using OpeniddictServer.Areas.Identity.Pages.Account
--------------------------------------------------------------------------------
/IdentityProvider/Areas/Identity/Pages/_ViewStart.cshtml:
--------------------------------------------------------------------------------
1 |
2 | @{
3 | Layout = "/Views/Shared/_Layout.cshtml";
4 | }
5 |
--------------------------------------------------------------------------------
/BlazorWebApp/wwwroot/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/damienbod/BlazorServerOidc/HEAD/BlazorWebApp/wwwroot/favicon.png
--------------------------------------------------------------------------------
/Old/BlazorServerOidc/wwwroot/.well-known/security.txt:
--------------------------------------------------------------------------------
1 | Security email
2 |
3 | contact: mailto: security-dev-officer@secure.ch
4 |
--------------------------------------------------------------------------------
/IdentityProvider/Areas/Identity/Pages/Account/Manage/_ViewImports.cshtml:
--------------------------------------------------------------------------------
1 | @using OpeniddictServer.Areas.Identity.Pages.Account.Manage
2 |
--------------------------------------------------------------------------------
/IdentityProvider/wwwroot/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/damienbod/BlazorServerOidc/HEAD/IdentityProvider/wwwroot/favicon.ico
--------------------------------------------------------------------------------
/Old/BlazorServerOidc/wwwroot/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/damienbod/BlazorServerOidc/HEAD/Old/BlazorServerOidc/wwwroot/favicon.ico
--------------------------------------------------------------------------------
/Old/BlazorWebFromBlazorServerOidc/wwwroot/.well-known/security.txt:
--------------------------------------------------------------------------------
1 | Security email
2 |
3 | contact: mailto: security-dev-officer@secure.ch
4 |
--------------------------------------------------------------------------------
/BlazorWebApp/Components/Pages/Home.razor:
--------------------------------------------------------------------------------
1 | @page "/"
2 |
3 |
Use this page to detail your site's privacy policy.
7 | -------------------------------------------------------------------------------- /Old/BlazorServerOidc/wwwroot/css/open-iconic/font/fonts/open-iconic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/damienbod/BlazorServerOidc/HEAD/Old/BlazorServerOidc/wwwroot/css/open-iconic/font/fonts/open-iconic.eot -------------------------------------------------------------------------------- /Old/BlazorServerOidc/wwwroot/css/open-iconic/font/fonts/open-iconic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/damienbod/BlazorServerOidc/HEAD/Old/BlazorServerOidc/wwwroot/css/open-iconic/font/fonts/open-iconic.otf -------------------------------------------------------------------------------- /Old/BlazorServerOidc/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/damienbod/BlazorServerOidc/HEAD/Old/BlazorServerOidc/wwwroot/css/open-iconic/font/fonts/open-iconic.ttf -------------------------------------------------------------------------------- /Old/BlazorServerOidc/wwwroot/css/open-iconic/font/fonts/open-iconic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/damienbod/BlazorServerOidc/HEAD/Old/BlazorServerOidc/wwwroot/css/open-iconic/font/fonts/open-iconic.woff -------------------------------------------------------------------------------- /Old/BlazorServerOidc/Pages/Index.razor: -------------------------------------------------------------------------------- 1 | @page "/" 2 | 3 |Learn about building Web apps with ASP.NET Core.
8 |Current count: @currentCount
8 | 9 | 10 | 11 | @code { 12 | private int currentCount = 0; 13 | 14 | private void IncrementCount() 15 | { 16 | currentCount++; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Old/BlazorWebFromBlazorServerOidc/Pages/Counter.razor: -------------------------------------------------------------------------------- 1 | @page "/counter" 2 | 3 |Current count: @currentCount
8 | 9 | 10 | 11 | @code { 12 | private int currentCount = 0; 13 | 14 | private void IncrementCount() 15 | { 16 | currentCount++; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /IdentityProvider/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "OpeniddictServer": { 4 | "commandName": "Project", 5 | "launchBrowser": true, 6 | "environmentVariables": { 7 | "ASPNETCORE_ENVIRONMENT": "Development", 8 | "ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" 9 | }, 10 | "applicationUrl": "https://localhost:44318/" 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /BlazorWebApp/Components/Pages/Counter.razor: -------------------------------------------------------------------------------- 1 | @page "/counter" 2 | @rendermode InteractiveServer 3 | 4 |Current count: @currentCount
9 | 10 | 11 | 12 | @code { 13 | private int currentCount = 0; 14 | 15 | private void IncrementCount() 16 | { 17 | currentCount++; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Old/BlazorServerOidc/_Imports.razor: -------------------------------------------------------------------------------- 1 | @using System.Net.Http 2 | @using Microsoft.AspNetCore.Authorization 3 | @using Microsoft.AspNetCore.Components.Authorization 4 | @using Microsoft.AspNetCore.Components.Forms 5 | @using Microsoft.AspNetCore.Components.Routing 6 | @using Microsoft.AspNetCore.Components.Web 7 | @using Microsoft.AspNetCore.Components.Web.Virtualization 8 | @using Microsoft.JSInterop 9 | @using BlazorServerOidc 10 | @using BlazorServerOidc.Shared 11 | -------------------------------------------------------------------------------- /BlazorWebApp/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/launchsettings.json", 3 | "profiles": { 4 | "BlazorWeb": { 5 | "commandName": "Project", 6 | "dotnetRunMessages": true, 7 | "launchBrowser": true, 8 | "applicationUrl": "https://localhost:5001", 9 | "environmentVariables": { 10 | "ASPNETCORE_ENVIRONMENT": "Development" 11 | } 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /IdentityProvider/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @model ErrorViewModel 2 | 3 |6 | @if (!string.IsNullOrEmpty(Model.Error)) { 7 | @Model.Error 8 | } 9 | 10 | @if (!string.IsNullOrEmpty(Model.ErrorDescription)) { 11 | @Model.ErrorDescription 12 | } 13 |
14 |Are you sure you want to sign out?
6 | 7 | 17 |You are not authorized to access this resource.
16 | } 17 |13 | This action only disables 2FA. 14 |
15 |16 | Disabling 2FA does not change the keys used in authenticator apps. If you wish to change the key 17 | used in an authenticator app you should reset your authenticator keys. 18 |
19 |Do you want to grant @Model.ApplicationName access to your data? (scopes requested: @Model.Scope)
8 | 9 | 20 |Sorry, there's nothing at this address.
21 |Sorry, there's nothing at this address.
21 |This component demonstrates fetching data from a service.
11 | 12 | @if (forecasts == null) 13 | { 14 |Loading...
15 | } 16 | else 17 | { 18 || Date | 22 |Temp. (C) | 23 |Temp. (F) | 24 |Summary | 25 |
|---|---|---|---|
| @forecast.Date.ToShortDateString() | 32 |@forecast.TemperatureC | 33 |@forecast.TemperatureF | 34 |@forecast.Summary | 35 |
12 | Request ID: @RequestId
13 |
18 | Swapping to Development environment will display more detailed information about the error that occurred. 19 |
20 |21 | The Development environment shouldn't be enabled for deployed applications. 22 | It can result in displaying sensitive information from exceptions to end users. 23 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 24 | and restarting the app. 25 |
26 | 27 | @code{ 28 | [CascadingParameter] 29 | private HttpContext? HttpContext { get; set; } 30 | 31 | private string? RequestId { get; set; } 32 | private bool ShowRequestId => !string.IsNullOrEmpty(RequestId); 33 | 34 | protected override void OnInitialized() => 35 | RequestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier; 36 | } 37 | -------------------------------------------------------------------------------- /Old/BlazorWebFromBlazorServerOidc/Pages/FetchData.razor: -------------------------------------------------------------------------------- 1 | @page "/fetchdata" 2 | 3 |This component demonstrates fetching data from a service.
11 | 12 | @if (forecasts == null) 13 | { 14 |Loading...
15 | } 16 | else 17 | { 18 || Date | 22 |Temp. (C) | 23 |Temp. (F) | 24 |Summary | 25 |
|---|---|---|---|
| @forecast.Date.ToShortDateString() | 32 |@forecast.TemperatureC | 33 |@forecast.TemperatureF | 34 |@forecast.Summary | 35 |
24 | Request ID: @Model.RequestId
25 |
30 | Swapping to the Development environment displays detailed information about the error that occurred. 31 |
32 |33 | The Development environment shouldn't be enabled for deployed applications. 34 | It can result in displaying sensitive information from exceptions to end users. 35 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 36 | and restarting the app. 37 |
38 |
24 | Request ID: @Model.RequestId
25 |
30 | Swapping to the Development environment displays detailed information about the error that occurred. 31 |
32 |33 | The Development environment shouldn't be enabled for deployed applications. 34 | It can result in displaying sensitive information from exceptions to end users. 35 | For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development 36 | and restarting the app. 37 |
38 |This component demonstrates showing data.
9 | 10 | @if (forecasts == null) 11 | { 12 |Loading...
13 | } 14 | else 15 | { 16 || Date | 20 |Temp. (C) | 21 |Temp. (F) | 22 |Summary | 23 |
|---|---|---|---|
| @forecast.Date.ToShortDateString() | 30 |@forecast.TemperatureC | 31 |@forecast.TemperatureF | 32 |@forecast.Summary | 33 |
You have successfully signed out
39 |You have successfully signed out
39 |This is scenario where we just want to use FIDO as the MFA. The user register and logins with their username and password. For demo purposes, we trigger the MFA registering on sign up.
This is scenario where we just want to use FIDO as the MFA. The user register and logins with their username and password. For demo purposes, we trigger the MFA registering on sign up.
You must generate a new set of recovery codes before you can log in with a recovery code.
22 |You can generate a new set of recovery codes.
29 |You should generate a new set of recovery codes.
36 |You must accept the policy before you can enable two factor authentication.
65 |