This commit is contained in:
Ccjcarkbla
2026-02-23 08:00:41 -05:00
parent a89f1810b5
commit 829a71ab5e
124 changed files with 76395 additions and 2 deletions
@@ -0,0 +1,13 @@
using Microsoft.AspNetCore.Authentication;
namespace maintenance.Authentication.Abstractions;
public interface IAuthProvider
{
string Mode { get; }
AuthenticationBuilder Configure(
AuthenticationBuilder builder,
IConfiguration configuration);
}
@@ -0,0 +1,10 @@
using maintenance.Authentication.Core;
using System.Security.Claims;
namespace maintenance.Authentication.Abstractions;
public interface IIdentityContextFactory
{
IdentityContext Create(ClaimsPrincipal principal);
}
@@ -0,0 +1,16 @@
namespace maintenance.Authentication.Configuration;
public static class AuthEnvironment
{
public const string AuthMode = "AUTH_MODE";
public const string AdminGroups = "AUTH_ADMIN_GROUPS";
public const string AdfsMetadataAddress = "ADFS_METADATA_ADDRESS";
public const string AdfsRealm = "ADFS_WTRELM";
public const string AdfsReply = "ADFS_WREPLY";
public const string AdfsCallbackPath = "ADFS_CALLBACK_PATH";
public const string AdfsHomeRealm = "ADFS_WHR";
public const string AdfsAuthType = "ADFS_WAUTH";
public const string AdfsValidIssuers = "ADFS_VALID_ISSUERS";
}
@@ -0,0 +1,8 @@
namespace maintenance.Authentication.Configuration;
public static class AuthModes
{
public const string WsFed = "WSFED";
public const string Oidc = "OIDC";
}
@@ -0,0 +1,59 @@
using maintenance.Authentication.Configuration;
using Microsoft.AspNetCore.Authentication;
using System.Security.Claims;
namespace maintenance.Authentication.Core;
public sealed class AdminRoleClaimsTransformation : IClaimsTransformation
{
private static readonly string[] GroupClaimTypes =
{
"groups",
"group",
ClaimTypes.GroupSid,
"http://schemas.xmlsoap.org/claims/Group"
};
private readonly IConfiguration _configuration;
public AdminRoleClaimsTransformation(IConfiguration configuration)
{
_configuration = configuration;
}
public Task<ClaimsPrincipal> TransformAsync(ClaimsPrincipal principal)
{
if (principal.Identity is not ClaimsIdentity identity || !identity.IsAuthenticated)
{
return Task.FromResult(principal);
}
if (identity.Claims.Any(c => c.Type == ClaimTypes.Role && c.Value == AuthRoles.Admin))
{
return Task.FromResult(principal);
}
var configuredGroups = (_configuration[AuthEnvironment.AdminGroups] ?? string.Empty)
.Split(';', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
if (configuredGroups.Length == 0)
{
return Task.FromResult(principal);
}
var principalGroups = identity.Claims
.Where(c => GroupClaimTypes.Contains(c.Type, StringComparer.OrdinalIgnoreCase))
.Select(c => c.Value);
var isAdmin = principalGroups.Any(group =>
configuredGroups.Contains(group, StringComparer.OrdinalIgnoreCase));
if (isAdmin)
{
identity.AddClaim(new Claim(ClaimTypes.Role, AuthRoles.Admin));
}
return Task.FromResult(principal);
}
}
+7
View File
@@ -0,0 +1,7 @@
namespace maintenance.Authentication.Core;
public static class AuthRoles
{
public const string Admin = "Admin";
}
+10
View File
@@ -0,0 +1,10 @@
namespace maintenance.Authentication.Core;
public sealed class IdentityContext
{
public required string UserId { get; init; }
public required string DisplayName { get; init; }
public required IReadOnlyCollection<string> Groups { get; init; }
public required IReadOnlyCollection<string> Roles { get; init; }
}
@@ -0,0 +1,48 @@
using maintenance.Authentication.Abstractions;
using System.Security.Claims;
namespace maintenance.Authentication.Core;
public sealed class IdentityContextFactory : IIdentityContextFactory
{
private static readonly string[] GroupClaimTypes =
{
"groups",
"group",
ClaimTypes.GroupSid,
"http://schemas.xmlsoap.org/claims/Group"
};
public IdentityContext Create(ClaimsPrincipal principal)
{
var groups = principal.Claims
.Where(c => GroupClaimTypes.Contains(c.Type, StringComparer.OrdinalIgnoreCase))
.Select(c => c.Value)
.Distinct(StringComparer.OrdinalIgnoreCase)
.ToArray();
var roles = principal.Claims
.Where(c => c.Type == ClaimTypes.Role)
.Select(c => c.Value)
.Distinct(StringComparer.OrdinalIgnoreCase)
.ToArray();
var userId = principal.FindFirstValue(ClaimTypes.NameIdentifier)
?? principal.FindFirstValue("sub")
?? principal.Identity?.Name
?? "unknown";
var displayName = principal.FindFirstValue(ClaimTypes.Name)
?? principal.Identity?.Name
?? userId;
return new IdentityContext
{
UserId = userId,
DisplayName = displayName,
Groups = groups,
Roles = roles
};
}
}
@@ -0,0 +1,124 @@
using maintenance.Authentication.Abstractions;
using maintenance.Authentication.Configuration;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.WsFederation;
using Microsoft.IdentityModel.Protocols.WsFederation;
using Microsoft.IdentityModel.Tokens;
using Microsoft.IdentityModel.Tokens.Saml;
namespace maintenance.Authentication.Providers.AdfsWsFed;
public sealed class AdfsWsFedAuthProvider : IAuthProvider
{
public const string Scheme = WsFederationDefaults.AuthenticationScheme;
public string Mode => AuthModes.WsFed;
AuthenticationBuilder IAuthProvider.Configure(
AuthenticationBuilder builder,
IConfiguration configuration)
{
var metadataAddress = configuration[AuthEnvironment.AdfsMetadataAddress];
var realm = configuration[AuthEnvironment.AdfsRealm];
var callbackPath = configuration[AuthEnvironment.AdfsCallbackPath] ?? "/signin-wsfed";
var replyUrl = configuration[AuthEnvironment.AdfsReply];
var homeRealm = configuration[AuthEnvironment.AdfsHomeRealm];
var authType = configuration[AuthEnvironment.AdfsAuthType];
var configuredValidIssuers = configuration[AuthEnvironment.AdfsValidIssuers];
if (string.IsNullOrWhiteSpace(metadataAddress))
{
throw new InvalidOperationException(
$"Missing required configuration: {AuthEnvironment.AdfsMetadataAddress}");
}
if (string.IsNullOrWhiteSpace(realm))
{
throw new InvalidOperationException(
$"Missing required configuration: {AuthEnvironment.AdfsRealm}");
}
var validIssuers = configuredValidIssuers?
.Split(';', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries)
.Where(v => !string.IsNullOrWhiteSpace(v))
.ToArray() ?? [];
if (validIssuers.Length == 0 && Uri.TryCreate(metadataAddress, UriKind.Absolute, out var metadataUri))
{
validIssuers = [$"{metadataUri.Scheme}://{metadataUri.Authority}/adfs/services/trust"];
}
return builder.AddWsFederation(options =>
{
options.MetadataAddress = metadataAddress;
options.Wtrealm = realm;
options.CallbackPath = callbackPath;
options.CorrelationCookie.SecurePolicy = CookieSecurePolicy.Always;
if (!string.IsNullOrWhiteSpace(replyUrl))
{
options.Wreply = replyUrl;
}
options.TokenHandlers.Clear();
options.TokenHandlers.Add(new CustomSamlSecurityTokenHandler());
options.TokenValidationParameters = new TokenValidationParameters
{
ValidateIssuer = true,
ValidIssuers = validIssuers
};
options.Events = new WsFederationEvents
{
OnRedirectToIdentityProvider = context =>
{
context.ProtocolMessage ??= new WsFederationMessage();
if (!string.IsNullOrWhiteSpace(replyUrl))
{
context.ProtocolMessage.Wreply = replyUrl;
}
if (!string.IsNullOrWhiteSpace(homeRealm))
{
context.ProtocolMessage.Whr = homeRealm;
}
if (!string.IsNullOrWhiteSpace(authType))
{
context.ProtocolMessage.Wa = authType;
}
return Task.CompletedTask;
}
};
});
}
private sealed class CustomSamlSecurityTokenHandler : SamlSecurityTokenHandler
{
public override async Task<TokenValidationResult> ValidateTokenAsync(
string token,
TokenValidationParameters validationParameters)
{
if (validationParameters.ConfigurationManager is not null)
{
var federationConfig = await validationParameters.ConfigurationManager
.GetBaseConfigurationAsync(CancellationToken.None)
.ConfigureAwait(false);
var dynamicIssuers = new[] { federationConfig.Issuer };
validationParameters.ValidIssuers = validationParameters.ValidIssuers is null
? dynamicIssuers
: validationParameters.ValidIssuers.Concat(dynamicIssuers);
validationParameters.IssuerSigningKeys = validationParameters.IssuerSigningKeys is null
? federationConfig.SigningKeys
: validationParameters.IssuerSigningKeys.Concat(federationConfig.SigningKeys);
}
return await base.ValidateTokenAsync(token, validationParameters).ConfigureAwait(false);
}
}
}
@@ -0,0 +1,21 @@
using maintenance.Authentication.Abstractions;
using maintenance.Authentication.Configuration;
using Microsoft.AspNetCore.Authentication;
namespace maintenance.Authentication.Providers.Oidc;
public sealed class OidcAuthProvider : IAuthProvider
{
public const string Scheme = "oidc";
public string Mode => AuthModes.Oidc;
public AuthenticationBuilder Configure(
AuthenticationBuilder builder,
IConfiguration configuration)
{
throw new NotSupportedException(
"OIDC provider is not implemented yet. Set AUTH_MODE=WSFED for current deployment.");
}
}
+91
View File
@@ -0,0 +1,91 @@
using maintenance.Data.Entities;
using Microsoft.EntityFrameworkCore;
namespace maintenance.Data;
public sealed class AppDbContext : DbContext
{
public AppDbContext(DbContextOptions<AppDbContext> options) : base(options)
{
}
public DbSet<TemplateEntity> Templates => Set<TemplateEntity>();
public DbSet<AppMappingEntity> AppMappings => Set<AppMappingEntity>();
public DbSet<FeatureFlagEntity> FeatureFlags => Set<FeatureFlagEntity>();
public DbSet<MaintenanceWindowEntity> MaintenanceWindows => Set<MaintenanceWindowEntity>();
public DbSet<AuthorizationGroupEntity> AuthorizationGroups => Set<AuthorizationGroupEntity>();
public DbSet<PermissionRuleEntity> PermissionRules => Set<PermissionRuleEntity>();
public DbSet<AuditRecordEntity> AuditRecords => Set<AuditRecordEntity>();
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<TemplateEntity>(e =>
{
e.ToTable("Template");
e.HasKey(x => x.Id);
e.Property(x => x.Name).HasMaxLength(50).IsRequired();
e.Property(x => x.Title).HasMaxLength(200).IsRequired();
e.Property(x => x.LastUpdatedBy).HasMaxLength(200).IsRequired();
e.HasIndex(x => x.Name).IsUnique();
});
modelBuilder.Entity<AppMappingEntity>(e =>
{
e.ToTable("AppMapping");
e.HasKey(x => x.Id);
e.Property(x => x.AppId).HasMaxLength(100).IsRequired();
e.Property(x => x.DisplayName).HasMaxLength(200).IsRequired();
e.Property(x => x.DefaultTemplate).HasMaxLength(50).IsRequired();
e.HasIndex(x => x.AppId).IsUnique();
});
modelBuilder.Entity<FeatureFlagEntity>(e =>
{
e.ToTable("FeatureFlag");
e.HasKey(x => x.Id);
e.Property(x => x.Key).HasMaxLength(100).IsRequired();
e.Property(x => x.Scope).HasMaxLength(50).IsRequired();
e.HasIndex(x => new { x.Key, x.Scope }).IsUnique();
});
modelBuilder.Entity<MaintenanceWindowEntity>(e =>
{
e.ToTable("MaintenanceWindow");
e.HasKey(x => x.Id);
e.Property(x => x.AppId).HasMaxLength(100);
e.HasIndex(x => new { x.AppId, x.StartTimeEastern, x.EndTimeEastern });
});
modelBuilder.Entity<AuthorizationGroupEntity>(e =>
{
e.ToTable("AuthorizationGroup");
e.HasKey(x => x.Id);
e.Property(x => x.GroupClaimValue).HasMaxLength(256).IsRequired();
e.Property(x => x.Role).HasMaxLength(50).IsRequired();
e.HasIndex(x => x.GroupClaimValue).IsUnique();
});
modelBuilder.Entity<PermissionRuleEntity>(e =>
{
e.ToTable("PermissionRule");
e.HasKey(x => x.Id);
e.Property(x => x.PermissionKey).HasMaxLength(200).IsRequired();
e.Property(x => x.Effect).HasMaxLength(10).IsRequired();
e.HasOne(x => x.Group)
.WithMany()
.HasForeignKey(x => x.GroupId)
.OnDelete(DeleteBehavior.Cascade);
e.HasIndex(x => new { x.PermissionKey, x.GroupId }).IsUnique();
});
modelBuilder.Entity<AuditRecordEntity>(e =>
{
e.ToTable("AuditRecord");
e.HasKey(x => x.Id);
e.Property(x => x.Actor).HasMaxLength(200).IsRequired();
e.Property(x => x.Action).HasMaxLength(100).IsRequired();
e.Property(x => x.Target).HasMaxLength(200).IsRequired();
e.HasIndex(x => x.TimestampUtc);
});
}
}
+11
View File
@@ -0,0 +1,11 @@
namespace maintenance.Data.Entities;
public sealed class AppMappingEntity
{
public Guid Id { get; set; }
public string AppId { get; set; } = string.Empty;
public string DisplayName { get; set; } = string.Empty;
public string DefaultTemplate { get; set; } = "down";
public string AllowedFieldsJson { get; set; } = "[]";
public bool Active { get; set; } = true;
}
+11
View File
@@ -0,0 +1,11 @@
namespace maintenance.Data.Entities;
public sealed class AuditRecordEntity
{
public Guid Id { get; set; }
public string Actor { get; set; } = string.Empty;
public string Action { get; set; } = string.Empty;
public string Target { get; set; } = string.Empty;
public DateTime TimestampUtc { get; set; }
public string? Diff { get; set; }
}
@@ -0,0 +1,9 @@
namespace maintenance.Data.Entities;
public sealed class AuthorizationGroupEntity
{
public Guid Id { get; set; }
public string GroupClaimValue { get; set; } = string.Empty;
public string Role { get; set; } = "admin";
public bool Active { get; set; } = true;
}
+9
View File
@@ -0,0 +1,9 @@
namespace maintenance.Data.Entities;
public sealed class FeatureFlagEntity
{
public Guid Id { get; set; }
public string Key { get; set; } = string.Empty;
public bool Enabled { get; set; }
public string Scope { get; set; } = "global";
}
+7
View File
@@ -0,0 +1,7 @@
namespace maintenance.Data.Entities;
public sealed class GroupLookupEntity
{
public string GroupClaimValue { get; set; } = string.Empty;
public string DisplayName { get; set; } = string.Empty;
}
+10
View File
@@ -0,0 +1,10 @@
namespace maintenance.Data.Entities;
public sealed class MaintenanceWindowEntity
{
public Guid Id { get; set; }
public string? AppId { get; set; }
public DateTime StartTimeEastern { get; set; }
public DateTime EndTimeEastern { get; set; }
public bool HideSupportContactDuringWindow { get; set; }
}
+11
View File
@@ -0,0 +1,11 @@
namespace maintenance.Data.Entities;
public sealed class PermissionRuleEntity
{
public Guid Id { get; set; }
public string PermissionKey { get; set; } = string.Empty;
public Guid GroupId { get; set; }
public string Effect { get; set; } = "allow";
public AuthorizationGroupEntity? Group { get; set; }
}
+12
View File
@@ -0,0 +1,12 @@
namespace maintenance.Data.Entities;
public sealed class TemplateEntity
{
public Guid Id { get; set; }
public string Name { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty;
public string Body { get; set; } = string.Empty;
public string? SupportContactBlock { get; set; }
public string LastUpdatedBy { get; set; } = string.Empty;
public DateTime LastUpdatedAtUtc { get; set; }
}
+46
View File
@@ -0,0 +1,46 @@
using maintenance.Data.Entities;
using Microsoft.EntityFrameworkCore;
namespace maintenance.Data;
public sealed class GroupLookupDbContext : DbContext
{
public GroupLookupDbContext(DbContextOptions<GroupLookupDbContext> options) : base(options)
{
}
public DbSet<GroupLookupEntity> Groups => Set<GroupLookupEntity>();
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<GroupLookupEntity>(e =>
{
e.ToTable("GroupLookup");
e.HasKey(x => x.GroupClaimValue);
e.Property(x => x.GroupClaimValue).HasMaxLength(256).IsRequired();
e.Property(x => x.DisplayName).HasMaxLength(256).IsRequired();
});
}
public override int SaveChanges()
{
throw new NotSupportedException("GroupLookupDbContext is read-only.");
}
public override int SaveChanges(bool acceptAllChangesOnSuccess)
{
throw new NotSupportedException("GroupLookupDbContext is read-only.");
}
public override Task<int> SaveChangesAsync(CancellationToken cancellationToken = default)
{
throw new NotSupportedException("GroupLookupDbContext is read-only.");
}
public override Task<int> SaveChangesAsync(
bool acceptAllChangesOnSuccess,
CancellationToken cancellationToken = default)
{
throw new NotSupportedException("GroupLookupDbContext is read-only.");
}
}
+16
View File
@@ -0,0 +1,16 @@
{
"AUTH_MODE": "WSFED",
"AUTH_ADMIN_GROUPS": "maintenance-Admins;maintenance-SuperAdmins",
"ADFS_METADATA_ADDRESS": "https://adfs.example.com/federationmetadata/2007-06/federationmetadata.xml",
"ADFS_WTRELM": "URN:WSFEDAPP",
"ADFS_VALID_ISSUERS": "https://adfs.example.com/adfs/services/trust;http://adfs.example.com/adfs/services/trust",
"ADFS_WREPLY": "https://localhost:44374/signin-wsfed",
"ADFS_WHR": "",
"ADFS_WAUTH": "",
"ADFS_CALLBACK_PATH": "/signin-wsfed",
"ConnectionStrings": {
"PrimaryDb": "Server=localhost;Database=maintenance;User Id=svc_errorpages;Password=CHANGE_ME;TrustServerCertificate=True",
"GroupLookupDb": "Server=localhost;Database=GroupLookup;User Id=svc_errorpages;Password=CHANGE_ME;TrustServerCertificate=True"
}
}
+16
View File
@@ -0,0 +1,16 @@
{
"AUTH_MODE": "WSFED",
"AUTH_ADMIN_GROUPS": "maintenance-Admins;maintenance-SuperAdmins",
"ADFS_METADATA_ADDRESS": "https://adfs.omb.gov/federationmetadata/2007-06/federationmetadata.xml",
"ADFS_WTRELM": "URN:WSFEDAPP",
"ADFS_VALID_ISSUERS": "https://adfs.omb.gov/adfs/services/trust;http://adfs.omb.gov/adfs/services/trust",
"ADFS_WREPLY": "https://localhost:44374/signin-wsfed",
"ADFS_WHR": "https://adfs.t.g:44373",
"ADFS_WAUTH": "urn:oasis:names:tc:SAML:2.0:ac:classes:TLSClient",
"ADFS_CALLBACK_PATH": "/signin-wsfed",
"ConnectionStrings": {
"PrimaryDb": "Server=localhost;Database=maintenance;User Id=svc_errorpages;Password=CHANGE_ME;TrustServerCertificate=True",
"GroupLookupDb": "Server=localhost;Database=GroupLookup;User Id=svc_errorpages;Password=CHANGE_ME;TrustServerCertificate=True"
}
}
+11
View File
@@ -0,0 +1,11 @@
@page
@model maintenance.Pages.AccessDeniedModel
@{
ViewData["Title"] = "Access Denied";
}
<div class="text-center">
<h1 class="display-5">Access Denied</h1>
<p>Your account is authenticated but does not have permission for this page.</p>
</div>
+11
View File
@@ -0,0 +1,11 @@
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace maintenance.Pages;
public class AccessDeniedModel : PageModel
{
public void OnGet()
{
}
}
+11
View File
@@ -0,0 +1,11 @@
@page
@model maintenance.Pages.Admin.IndexModel
@{
ViewData["Title"] = "Admin";
}
<div class="text-center">
<h1 class="display-5">Admin Console</h1>
<p>This page is protected by the <code>AdminOnly</code> policy.</p>
</div>
+13
View File
@@ -0,0 +1,13 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace maintenance.Pages.Admin;
[Authorize(Policy = "AdminOnly")]
public class IndexModel : PageModel
{
public void OnGet()
{
}
}
+26
View File
@@ -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>
+28
View File
@@ -0,0 +1,28 @@
using System.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace maintenance.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;
}
}
+10
View File
@@ -0,0 +1,10 @@
@page
@model IndexModel
@{
ViewData["Title"] = "Home page";
}
<div class="text-center">
<h1 class="display-4">Welcome</h1>
<p>Learn about <a href="https://learn.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
</div>
+20
View File
@@ -0,0 +1,20 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace maintenance.Pages;
public class IndexModel : PageModel
{
private readonly ILogger<IndexModel> _logger;
public IndexModel(ILogger<IndexModel> logger)
{
_logger = logger;
}
public void OnGet()
{
}
}
+8
View File
@@ -0,0 +1,8 @@
@page
@model PrivacyModel
@{
ViewData["Title"] = "Privacy Policy";
}
<h1>@ViewData["Title"]</h1>
<p>Use this page to detail your site's privacy policy.</p>
+20
View File
@@ -0,0 +1,20 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace maintenance.Pages;
public class PrivacyModel : PageModel
{
private readonly ILogger<PrivacyModel> _logger;
public PrivacyModel(ILogger<PrivacyModel> logger)
{
_logger = logger;
}
public void OnGet()
{
}
}
+51
View File
@@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - maintenance</title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
<link rel="stylesheet" href="~/maintenance.styles.css" asp-append-version="true" />
</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">maintenance</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-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="/Privacy">Privacy</a>
</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; 2026 - maintenance - <a asp-area="" asp-page="/Privacy">Privacy</a>
</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>
+48
View File
@@ -0,0 +1,48 @@
/* Please see documentation at https://learn.microsoft.com/aspnet/core/client-side/bundling-and-minification
for details on configuring this project to bundle and minify static web assets. */
a.navbar-brand {
white-space: normal;
text-align: center;
word-break: break-all;
}
a {
color: #0077cc;
}
.btn-primary {
color: #fff;
background-color: #1b6ec2;
border-color: #1861ac;
}
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
color: #fff;
background-color: #1b6ec2;
border-color: #1861ac;
}
.border-top {
border-top: 1px solid #e5e5e5;
}
.border-bottom {
border-bottom: 1px solid #e5e5e5;
}
.box-shadow {
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05);
}
button.accept-policy {
font-size: 1rem;
line-height: inherit;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
white-space: nowrap;
line-height: 60px;
}
@@ -0,0 +1,2 @@
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
+4
View File
@@ -0,0 +1,4 @@
@using maintenance
@namespace maintenance.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
+3
View File
@@ -0,0 +1,3 @@
@{
Layout = "_Layout";
}
+135
View File
@@ -0,0 +1,135 @@
using maintenance.Authentication.Abstractions;
using maintenance.Authentication.Configuration;
using maintenance.Authentication.Core;
using maintenance.Authentication.Providers.AdfsWsFed;
using maintenance.Authentication.Providers.Oidc;
using maintenance.Data;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authorization;
using Microsoft.EntityFrameworkCore;
using System.Security.Claims;
var builder = WebApplication.CreateBuilder(args);
if (builder.Environment.IsDevelopment())
{
builder.Configuration.AddJsonFile("FutureSecrets.json", optional: true, reloadOnChange: true);
}
var primaryDbConnection = builder.Configuration.GetConnectionString("PrimaryDb");
var groupLookupDbConnection = builder.Configuration.GetConnectionString("GroupLookupDb");
if (string.IsNullOrWhiteSpace(primaryDbConnection))
{
throw new InvalidOperationException("Missing connection string: ConnectionStrings:PrimaryDb");
}
if (string.IsNullOrWhiteSpace(groupLookupDbConnection))
{
throw new InvalidOperationException("Missing connection string: ConnectionStrings:GroupLookupDb");
}
builder.Services.AddDbContext<AppDbContext>(options =>
{
options.UseSqlServer(primaryDbConnection);
});
builder.Services.AddDbContext<GroupLookupDbContext>(options =>
{
options.UseSqlServer(groupLookupDbConnection);
options.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking);
});
builder.Services.AddRazorPages(options =>
{
options.Conventions.AuthorizeFolder("/Admin", "AdminOnly");
});
builder.Services.AddSingleton<IClaimsTransformation, AdminRoleClaimsTransformation>();
builder.Services.AddSingleton<IIdentityContextFactory, IdentityContextFactory>();
builder.Services.AddSingleton<IAuthProvider, AdfsWsFedAuthProvider>();
builder.Services.AddSingleton<IAuthProvider, OidcAuthProvider>();
var authMode = builder.Configuration[AuthEnvironment.AuthMode] ?? AuthModes.WsFed;
var challengeScheme = authMode.Equals(AuthModes.WsFed, StringComparison.OrdinalIgnoreCase)
? AdfsWsFedAuthProvider.Scheme
: OidcAuthProvider.Scheme;
var authBuilder = builder.Services.AddAuthentication(options =>
{
options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = challengeScheme;
});
authBuilder.AddCookie(options =>
{
options.Cookie.Name = "errorpages.auth";
options.AccessDeniedPath = "/AccessDenied";
});
var providers = new IAuthProvider[]
{
new AdfsWsFedAuthProvider(),
new OidcAuthProvider()
};
var provider = providers.FirstOrDefault(p =>
p.Mode.Equals(authMode, StringComparison.OrdinalIgnoreCase));
if (provider is null)
{
throw new InvalidOperationException($"Unsupported AUTH_MODE: {authMode}");
}
provider.Configure(authBuilder, builder.Configuration);
builder.Services.AddAuthorization(options =>
{
options.FallbackPolicy = new AuthorizationPolicyBuilder()
.RequireAuthenticatedUser()
.Build();
options.AddPolicy("AdminOnly", policy => policy.RequireRole(AuthRoles.Admin));
});
var app = builder.Build();
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.MapGet("/api/whoami", (ClaimsPrincipal user, IIdentityContextFactory identityFactory) =>
{
var identity = identityFactory.Create(user);
var claims = user.Claims
.Select(c => new { c.Type, c.Value })
.OrderBy(c => c.Type)
.ToArray();
return Results.Ok(new
{
identity.UserId,
identity.DisplayName,
identity.Groups,
identity.Roles,
IsAuthenticated = user.Identity?.IsAuthenticated ?? false,
AuthenticationType = user.Identity?.AuthenticationType,
Claims = claims
});
})
.RequireAuthorization();
app.MapRazorPages();
app.Run();
+586
View File
@@ -0,0 +1,586 @@
# Dynamic Error Pages - Project Plan
## 1. Project Summary
Build a centralized dynamic error page system that application teams can redirect users to when systems are unavailable, degraded, or under maintenance. The platform will support:
- ADFS passthrough authentication
- Role-based views (All Authenticated vs Admin)
- Admin-managed page templates and content flags
- API handlers for admin pages and app-to-page redirects with runtime details
- Time-gated content visibility rules
- Kubernetes hosting behind Traefik ingress
## 2. Goals
1. Provide a consistent user-facing experience for outage and maintenance scenarios.
2. Let admins update messages without redeploying apps.
3. Allow source apps to redirect with contextual data that populates templates.
4. Enforce security and role-based access for editing/administration.
5. Support conditional/time-based display rules (for example support contacts).
## 3. Scope
### In Scope
- ADFS authentication passthrough
- Authenticated user portal pages
- Admin portal pages for content/state management
- Catch-all templates for outage and maintenance states
- API endpoints for:
- Admin CRUD/configuration
- Source application runtime redirects/data payloads
- Feature flags and scheduling logic for content visibility
- Group-based role and permission management
- Deployment to Kubernetes behind Traefik
### Out of Scope (Initial Phase)
- Per-app fully custom page builder UI
- Multi-IdP auth support beyond ADFS
- Public unauthenticated access
## 4. Users and Access Model
### Authentication
- All platform routes require authentication.
- If authentication fails, upstream service blocks access and displays its own error page.
- This application does not provide an unauthenticated fallback page.
### Roles
- All Authenticated Users:
- Can view rendered error/maintenance pages.
- Cannot modify content.
- Admin Users:
- Can access admin UI and APIs.
- Can edit templates, flags, maintenance windows, app mappings, groups, and permissions.
### Authorization Strategy
- Use group membership claims from ADFS token to assign roles.
- Maintain configurable allowed admin group list (add/remove without code changes).
- Support granular authorization per page component/action.
- Apply role/permission checks at both UI route level and API handler level.
## 5. Functional Requirements
1. Support two generic catch-all templates:
- Maintenance page
- Application down/unavailable page
2. Admins can edit displayed content for both templates.
3. Source apps can redirect users to the system with details to populate template fields.
4. Admin API handlers provide data and routing/config for admin pages.
5. Admins can define flags controlling whether specific content blocks are shown.
6. Admins can define maintenance windows that influence content visibility.
7. Time-gated behavior example:
- Hide support contact details during active maintenance window.
- Show support contact details outside the maintenance window.
## 6. Non-Functional Requirements
- Backend database platform is Microsoft SQL Server (MSSQL).
- Delivery platform is Azure DevOps (repos/pipelines/releases).
- Secure by default with authenticated access and role checks.
- Database access uses a dedicated service account with least-privilege permissions.
- Highly available deployment in Kubernetes.
- Clear auditability for admin changes (who/what/when).
- Fast render path for redirect-based user flows.
- Configurable and maintainable API contract for calling apps.
## 7. Proposed Architecture
### Components
- Web UI Service:
- Renders generic templates.
- Hosts authenticated and admin views.
- Admin API Service:
- Template/content management.
- Flags and schedule management.
- App mapping and permissions management.
- Runtime Render API:
- Accepts app-provided context and resolves template variables.
- Data Store (MSSQL):
- Primary application database (read/write) stores templates, flags, schedules, app mappings, permissions, and audit records.
- Separate group lookup database is accessed read-only for resolving group names.
### Request Flow (High Level)
1. App encounters outage/maintenance state.
2. App redirects user to error page endpoint with app/context details.
3. Platform authenticates user via ADFS passthrough.
4. Render service resolves template + flags + current schedule state.
5. User sees appropriate dynamic page.
## 8. API Design (Draft)
### Admin APIs (Admin Role Required)
- `GET /api/admin/templates`
- `PUT /api/admin/templates/{templateId}`
- `GET /api/admin/apps`
- `PUT /api/admin/apps/{appId}`
- `GET /api/admin/flags`
- `PUT /api/admin/flags/{flagKey}`
- `GET /api/admin/windows`
- `POST /api/admin/windows`
- `PUT /api/admin/windows/{windowId}`
- `GET /api/admin/authorization/groups`
- `PUT /api/admin/authorization/groups`
- `GET /api/admin/authorization/permissions`
- `PUT /api/admin/authorization/permissions/{permissionKey}`
### Runtime APIs
- `POST /api/render`
- Input: app identifier + event type (maintenance/down) + optional details
- Output: resolved page model
### Runtime Payload Map (Initial JSON Draft)
```json
{
"requestId": "uuid",
"source": {
"appId": "billing-api",
"environment": "prod",
"instance": "billing-api-7c8d4f",
"signature": "optional-signed-token"
},
"event": {
"type": "maintenance",
"statusCode": "MAINT_001",
"occurredAtUtc": "2026-02-12T15:27:00Z"
},
"display": {
"title": "optional override",
"message": "optional override",
"details": [
{ "label": "Change Ticket", "value": "CHG12345" }
]
},
"support": {
"contactName": "Service Desk",
"contactEmail": "support@company.com",
"contactPhone": "800-000-0000"
},
"user": {
"timezone": "America/Chicago",
"locale": "en-US"
}
}
```
### Security
- Enforce role policy on `/api/admin/*`.
- Validate source app identity for runtime calls (shared secret, token, or mTLS).
## 9. Data Model (Draft)
### Template
- `id`
- `name` (`maintenance`, `down`)
- `title`
- `body`
- `supportContactBlock`
- `lastUpdatedBy`
- `lastUpdatedAt`
### AppMapping
- `appId`
- `displayName`
- `defaultTemplate`
- `allowedFields`
- `active`
### FeatureFlag
- `key`
- `enabled`
- `scope` (global/app/template)
### MaintenanceWindow
- `id`
- `appId` (nullable for global)
- `startTimeEastern`
- `endTimeEastern`
- `hideSupportContactDuringWindow` (bool)
- `displayTimezone` (derived from user context for UI presentation)
### AuthorizationGroup
- `id`
- `groupClaimValue`
- `role` (`admin`, future roles)
- `active`
### PermissionRule
- `id`
- `permissionKey` (for example `template.edit.body`, `template.edit.contact`, `window.manage`)
- `groupId`
- `effect` (`allow`/`deny`)
### AuditRecord
- `id`
- `actor`
- `action`
- `target`
- `timestampUtc`
- `diff`
## 10. UI Requirements
### Authenticated View
- Render user-facing page content only.
- Clean, readable status and guidance.
- Maintenance window source is Eastern time; render local-time equivalents for the user where appropriate.
### Admin View
- Edit maintenance/down templates.
- Toggle content flags.
- Create/manage maintenance windows (entered/stored as Eastern time).
- Manage authorization groups (add/remove).
- Manage granular permissions by page component/action.
- Preview rendered output with current rules.
## 11. Kubernetes and Traefik Deployment
- Deploy service(s) to Kubernetes namespace for shared platform tools.
- Use Azure DevOps for source control workflows, CI/CD pipelines, and release orchestration.
- Expose via Traefik ingress route(s) with TLS.
- Configure session/auth headers for ADFS passthrough integration.
- Store secrets (ADFS settings, API tokens, and DB service account credentials) in Kubernetes secrets.
- Add readiness/liveness probes and autoscaling targets.
## 12. Logging, Monitoring, and Audit
- Structured logs for render/admin actions.
- Metrics for request count, render latency, and error rates.
- Admin audit trail for all content/config, group, and permission changes.
- Alerts for elevated 5xx rates and auth failures.
## 13. Design Structure
### Layered Design
1. Edge Layer
- Traefik ingress, TLS termination, routing.
2. Auth Layer
- ADFS token passthrough, claim extraction, identity context creation.
3. Application Layer
- UI rendering, admin endpoints, runtime render endpoint.
4. Domain Layer
- Rules engine (flags, schedule checks, permission checks, template resolution).
5. Data Layer
- MSSQL repositories, transactional updates, audit persistence.
### Domain Modules
- `IdentityModule`: token claims, group resolution, role resolution.
- `AuthorizationModule`: permission evaluation by action/component.
- `TemplateModule`: template retrieval, placeholder validation, content overrides.
- `ScheduleModule`: Eastern-time window evaluation + user-local projection.
- `RenderModule`: resolves final page model with rule precedence.
- `AuditModule`: immutable audit writes for admin changes.
### Rule Evaluation Order
1. Authentication required.
2. Authorization checks (route + action).
3. App mapping validation.
4. Template selection.
5. Feature-flag checks.
6. Maintenance window checks.
7. Time-gated content filtering.
8. Final payload field allowlist enforcement.
9. Response render.
## 14. Rules Catalog
### Authentication Rules
- `AUTH-001`: All routes require valid authenticated identity.
- `AUTH-002`: Failed authentication is handled upstream; app does not render fallback unauthenticated pages.
### Authorization Rules
- `AUTHZ-001`: Admin access is granted only if token group claim matches configured active admin group.
- `AUTHZ-002`: Group list is config-driven (add/remove groups without redeploy).
- `AUTHZ-003`: Deny by default if no explicit allow rule exists.
- `AUTHZ-004`: Component-level permissions override broad role where configured.
### Rendering Rules
- `RND-001`: Only two base templates in phase 1: `maintenance`, `down`.
- `RND-002`: App-provided fields can only populate whitelisted template variables.
- `RND-003`: If app-provided template type is invalid, fallback to app default template.
- `RND-004`: If app mapping is missing/inactive, return controlled generic error response.
### Schedule and Timezone Rules
- `SCH-001`: Maintenance windows are authored and stored in Eastern time.
- `SCH-002`: Window comparisons are performed against Eastern-time normalized current time.
- `SCH-003`: User-facing timestamps are also displayed in the user timezone when available.
- `SCH-004`: If user timezone is missing, default display timezone is Eastern.
### Content Gating Rules
- `CNT-001`: `hideSupportContactDuringWindow=true` removes support blocks while window is active.
- `CNT-002`: Outside active windows, support blocks are shown unless independently disabled by flag.
- `CNT-003`: Explicit safety flags can suppress any optional content block globally.
### Payload Rules
- `PAY-001`: Runtime payload format is JSON only.
- `PAY-002`: Required fields: `source.appId`, `event.type`, `event.occurredAtUtc`.
- `PAY-003`: Unknown fields are ignored and logged for review.
- `PAY-004`: Payload size and field lengths are bounded to configured limits.
### Data Access Rules
- `DB-001`: Service account authenticates to MSSQL using credentials from Kubernetes secret.
- `DB-002`: Read/write granted only to primary application database.
- `DB-003`: Group lookup database access is read-only.
- `DB-004`: Write operations are audited with actor, timestamp, and diff.
## 15. Milestones
1. Foundation
- Auth integration, base service skeleton, data model.
2. Runtime Path
- Catch-all templates, runtime render endpoint, app redirect contract.
3. Admin Path
- Admin UI + admin APIs for templates/flags/windows/groups/permissions.
4. Deployment
- Kubernetes manifests/helm, Traefik ingress, observability.
5. Hardening
- Security tests, load tests, audit verification, documentation.
## 16. Open Questions
1. Exact claim name/format in ADFS token for group membership.
2. Permission model depth for initial release (coarse admin-only vs selected component-level permissions).
3. What SLA/SLO targets should this service meet?
## 17. Module Breakdown and Delivery Order
Project implementation will proceed module-by-module, validating each module before moving to the next.
### Module 1: Database
- Purpose: Provide durable storage and retrieval for templates, flags, windows, auth groups, permissions, app mappings, and audit records.
- Scope:
- MSSQL schema creation and migrations.
- Connection via service account secret from Kubernetes.
- Read/write permissions on primary app DB.
- Read-only permissions on group lookup DB.
- Validation Gate:
- Migration runs cleanly in lower environment.
- CRUD operations pass integration tests.
- Read-only enforcement confirmed on lookup DB.
### Module 2: Authentication
- Purpose: Enforce authenticated-only access and resolve token claims into identity context.
- Scope:
- ADFS passthrough integration.
- Claim extraction (user identity, group claims).
- Group-to-role mapping (`All Authenticated`, `Admin`).
- Deny-by-default behavior for non-authorized actions.
- Validation Gate:
- Authenticated users can access view routes.
- Unauthenticated requests are blocked upstream.
- Admin role assignment works from configured groups.
### Module 3: API
- Purpose: Expose runtime and admin endpoints with authorization, validation, and rules evaluation.
- Scope:
- Runtime render endpoint contract (JSON payload).
- Admin CRUD endpoints for templates, flags, windows, groups, permissions.
- Request validation, allowlist filtering, and audit logging hooks.
- Schedule/time-gate rule application.
- Validation Gate:
- Endpoint auth/authz checks pass.
- Runtime payload validation and rule resolution pass.
- Admin writes produce expected audit records.
### Module 4: Pages (Razor Pages)
- Purpose: Deliver user-facing and admin-facing UI over the API/domain logic.
- Scope:
- Authenticated user error page render flows.
- Admin screens for templates, flags, windows, groups, permissions.
- Preview behavior for schedule and content-gate outcomes.
- Clear separation of PageModel orchestration vs domain logic.
- Validation Gate:
- End-to-end render flow works from API payload to final page.
- Admin edit flows persist and reflect in runtime renders.
- UI route protections align with role/permission rules.
### Module Sequence
1. Database
2. Authentication
3. API
4. Pages
### Definition of Done Per Module
- Code complete for scoped module requirements.
- Automated tests added and passing for module responsibilities.
- Integration test against dependent module(s) passing.
- Deployment pipeline updated in Azure DevOps for module changes.
## 18. Authentication Service Draft (Razor Pages)
Initial implementation target is local development using environment variables and ADFS WS-Federation.
### ADFS Settings (Current)
- RPT Identifier (realm): `URN:WSFEDAPP`
- Local app URL: `https://localhost:44374`
- WS-Fed callback path: `/signin-wsfed`
### Local Environment Variables (Phase 1)
- `AUTH_MODE=WSFED`
- `ADFS_METADATA_ADDRESS=https://<adfs-host>/federationmetadata/2007-06/federationmetadata.xml`
- `ADFS_WTRELM=URN:WSFEDAPP`
- `ADFS_WREPLY=https://localhost:44374/signin-wsfed`
- `ADFS_CALLBACK_PATH=/signin-wsfed`
- `AUTH_ADMIN_GROUPS=<group1>;<group2>`
- `ASPNETCORE_URLS=https://localhost:44374`
### Program Startup Draft
```csharp
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authentication.WsFederation;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRazorPages();
builder.Services
.AddAuthentication(options =>
{
options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = WsFederationDefaults.AuthenticationScheme;
})
.AddCookie(options =>
{
options.Cookie.Name = "errorpages.auth";
options.AccessDeniedPath = "/AccessDenied";
})
.AddWsFederation(options =>
{
options.MetadataAddress = Environment.GetEnvironmentVariable("ADFS_METADATA_ADDRESS");
options.Wtrealm = Environment.GetEnvironmentVariable("ADFS_WTRELM");
options.Wreply = Environment.GetEnvironmentVariable("ADFS_WREPLY");
options.CallbackPath = Environment.GetEnvironmentVariable("ADFS_CALLBACK_PATH") ?? "/signin-wsfed";
});
builder.Services.AddAuthorization(options =>
{
options.AddPolicy("AdminOnly", policy => policy.RequireAssertion(ctx =>
{
var configured = (Environment.GetEnvironmentVariable("AUTH_ADMIN_GROUPS") ?? string.Empty)
.Split(';', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
return configured.Any(group =>
ctx.User.Claims.Any(c =>
(c.Type == "groups" || c.Type == "group" || c.Type.Contains("role")) &&
string.Equals(c.Value, group, StringComparison.OrdinalIgnoreCase)));
}));
});
var app = builder.Build();
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.MapRazorPages();
app.Run();
```
### Route Authorization Draft
- User-facing pages: authenticated users only.
- Admin pages (`/Admin/*`): authenticated + `AdminOnly` policy.
- No unauthenticated page rendering in this service.
### Validation Checklist for Module 2
1. Unauthenticated request to `/` triggers WS-Fed challenge.
2. Successful ADFS login issues app auth cookie.
3. User in configured admin group can access `/Admin`.
4. User not in admin group is denied from `/Admin`.
5. Invalid/missing token claims result in deny-by-default behavior.
## 19. Modular Authentication Design (Swappable Providers)
Authentication must be provider-agnostic so ADFS can be replaced later with OAuth/OIDC or another enterprise IdP without rewriting page/API authorization logic.
### Design Goals
- Keep UI/API authorization logic independent from authentication protocol.
- Swap provider through configuration (`AUTH_MODE`) and provider registration.
- Normalize claims into one internal identity model.
- Support multiple providers over time with minimal code churn.
### Proposed Folder Structure
- `Authentication/Abstractions`
- `IAuthProvider.cs`
- `IClaimsTransformer.cs`
- `IIdentityContextFactory.cs`
- `Authentication/Core`
- `IdentityContext.cs`
- `IdentityContextFactory.cs`
- `GroupRoleResolver.cs`
- `Authentication/Providers/AdfsWsFed`
- `AdfsWsFedAuthProvider.cs`
- `AdfsWsFedOptions.cs`
- `Authentication/Providers/Oidc` (future)
- `OidcAuthProvider.cs`
- `OidcOptions.cs`
- `Authentication/Configuration`
- `AuthOptions.cs`
- `AuthMode.cs`
### Core Contracts
```csharp
public interface IAuthProvider
{
string Mode { get; }
AuthenticationBuilder Configure(AuthenticationBuilder builder, IConfiguration config);
}
public interface IClaimsTransformer
{
ClaimsPrincipal Transform(ClaimsPrincipal principal);
}
public sealed class IdentityContext
{
public required string UserId { get; init; }
public required string DisplayName { get; init; }
public required IReadOnlyCollection<string> Groups { get; init; }
public required IReadOnlyCollection<string> Roles { get; init; }
}
```
### Provider Registration Pattern
```csharp
var authMode = Environment.GetEnvironmentVariable("AUTH_MODE") ?? "WSFED";
builder.Services.AddAuthentication(options =>
{
options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = authMode == "WSFED"
? WsFederationDefaults.AuthenticationScheme
: "oidc";
})
.AddCookie();
IAuthProvider provider = authMode switch
{
"WSFED" => new AdfsWsFedAuthProvider(),
"OIDC" => new OidcAuthProvider(), // future
_ => throw new InvalidOperationException($"Unsupported AUTH_MODE: {authMode}")
};
provider.Configure(builder.Services.AddAuthentication(), builder.Configuration);
```
### Normalized Identity Rules
- Map provider-specific claim names into canonical fields:
- `UserId`
- `DisplayName`
- `Groups`
- `Roles`
- Authorization and page/API policies must consume only normalized values.
- Never couple policy checks directly to raw provider claim types in page handlers.
### Authorization Integration
- `AdminOnly` policy evaluates normalized groups against configured admin groups.
- Component-level permissions use normalized group IDs, not provider-specific claim keys.
- Deny-by-default if group mapping cannot be resolved.
### Configuration Model
- Shared:
- `AUTH_MODE` (`WSFED`, future `OIDC`)
- `AUTH_ADMIN_GROUPS`
- ADFS WS-Fed:
- `ADFS_METADATA_ADDRESS`
- `ADFS_WTRELM`
- `ADFS_WREPLY`
- `ADFS_CALLBACK_PATH`
- OIDC (future):
- `OIDC_AUTHORITY`
- `OIDC_CLIENT_ID`
- `OIDC_CLIENT_SECRET`
- `OIDC_CALLBACK_PATH`
### Swap Strategy (ADFS to OIDC Example)
1. Implement `OidcAuthProvider` with same `IAuthProvider` contract.
2. Ensure OIDC claims are mapped into the same normalized identity context.
3. Set `AUTH_MODE=OIDC`.
4. Validate auth flows and policy outcomes without changing PageModel/API authorization code.
### Authentication Module Validation (Modular)
1. Provider bootstraps from `AUTH_MODE` without code changes.
2. Identity context generation is identical shape across providers.
3. `AdminOnly` policy behavior remains unchanged when switching providers.
4. Unauthorized users remain denied by default in all providers.
+39
View File
@@ -0,0 +1,39 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:2918",
"sslPort": 44368
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5231",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:44374;http://localhost:5231",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"AUTH_MODE": "WSFED"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
-2
View File
@@ -1,2 +0,0 @@
# maintenancepages
+9
View File
@@ -0,0 +1,9 @@
{
"DetailedErrors": true,
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
+9
View File
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
@@ -0,0 +1,16 @@
{
"AUTH_MODE": "WSFED",
"AUTH_ADMIN_GROUPS": "maintenance-Admins;maintenance-SuperAdmins",
"ADFS_METADATA_ADDRESS": "https://adfs.example.com/federationmetadata/2007-06/federationmetadata.xml",
"ADFS_WTRELM": "URN:WSFEDAPP",
"ADFS_VALID_ISSUERS": "https://adfs.example.com/adfs/services/trust;http://adfs.example.com/adfs/services/trust",
"ADFS_WREPLY": "https://localhost:44374/signin-wsfed",
"ADFS_WHR": "",
"ADFS_WAUTH": "",
"ADFS_CALLBACK_PATH": "/signin-wsfed",
"ConnectionStrings": {
"PrimaryDb": "Server=localhost;Database=maintenance;User Id=svc_errorpages;Password=CHANGE_ME;TrustServerCertificate=True",
"GroupLookupDb": "Server=localhost;Database=GroupLookup;User Id=svc_errorpages;Password=CHANGE_ME;TrustServerCertificate=True"
}
}
+16
View File
@@ -0,0 +1,16 @@
{
"AUTH_MODE": "WSFED",
"AUTH_ADMIN_GROUPS": "maintenance-Admins;maintenance-SuperAdmins",
"ADFS_METADATA_ADDRESS": "https://adfs.omb.gov/federationmetadata/2007-06/federationmetadata.xml",
"ADFS_WTRELM": "URN:WSFEDAPP",
"ADFS_VALID_ISSUERS": "https://adfs.omb.gov/adfs/services/trust;http://adfs.omb.gov/adfs/services/trust",
"ADFS_WREPLY": "https://localhost:44374/signin-wsfed",
"ADFS_WHR": "https://adfs.t.g:44373",
"ADFS_WAUTH": "urn:oasis:names:tc:SAML:2.0:ac:classes:TLSClient",
"ADFS_CALLBACK_PATH": "/signin-wsfed",
"ConnectionStrings": {
"PrimaryDb": "Server=localhost;Database=maintenance;User Id=svc_errorpages;Password=CHANGE_ME;TrustServerCertificate=True",
"GroupLookupDb": "Server=localhost;Database=GroupLookup;User Id=svc_errorpages;Password=CHANGE_ME;TrustServerCertificate=True"
}
}
Binary file not shown.
@@ -0,0 +1,9 @@
{
"DetailedErrors": true,
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
+9
View File
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
+209
View File
@@ -0,0 +1,209 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v8.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {
"maintenance/1.0.0": {
"dependencies": {
"Microsoft.AspNetCore.Authentication.WsFederation": "8.0.0"
},
"runtime": {
"maintenance.dll": {}
}
},
"Microsoft.AspNetCore.Authentication.WsFederation/8.0.0": {
"dependencies": {
"Microsoft.IdentityModel.Protocols.WsFederation": "7.0.3",
"System.IdentityModel.Tokens.Jwt": "7.0.3"
},
"runtime": {
"lib/net8.0/Microsoft.AspNetCore.Authentication.WsFederation.dll": {
"assemblyVersion": "8.0.0.0",
"fileVersion": "8.0.23.53112"
}
}
},
"Microsoft.IdentityModel.Abstractions/7.0.3": {
"runtime": {
"lib/net8.0/Microsoft.IdentityModel.Abstractions.dll": {
"assemblyVersion": "7.0.3.0",
"fileVersion": "7.0.3.41017"
}
}
},
"Microsoft.IdentityModel.JsonWebTokens/7.0.3": {
"dependencies": {
"Microsoft.IdentityModel.Tokens": "7.0.3"
},
"runtime": {
"lib/net8.0/Microsoft.IdentityModel.JsonWebTokens.dll": {
"assemblyVersion": "7.0.3.0",
"fileVersion": "7.0.3.41017"
}
}
},
"Microsoft.IdentityModel.Logging/7.0.3": {
"dependencies": {
"Microsoft.IdentityModel.Abstractions": "7.0.3"
},
"runtime": {
"lib/net8.0/Microsoft.IdentityModel.Logging.dll": {
"assemblyVersion": "7.0.3.0",
"fileVersion": "7.0.3.41017"
}
}
},
"Microsoft.IdentityModel.Protocols/7.0.3": {
"dependencies": {
"Microsoft.IdentityModel.Logging": "7.0.3",
"Microsoft.IdentityModel.Tokens": "7.0.3"
},
"runtime": {
"lib/net8.0/Microsoft.IdentityModel.Protocols.dll": {
"assemblyVersion": "7.0.3.0",
"fileVersion": "7.0.3.41017"
}
}
},
"Microsoft.IdentityModel.Protocols.WsFederation/7.0.3": {
"dependencies": {
"Microsoft.IdentityModel.Protocols": "7.0.3",
"Microsoft.IdentityModel.Tokens.Saml": "7.0.3",
"Microsoft.IdentityModel.Xml": "7.0.3"
},
"runtime": {
"lib/net8.0/Microsoft.IdentityModel.Protocols.WsFederation.dll": {
"assemblyVersion": "7.0.3.0",
"fileVersion": "7.0.3.41017"
}
}
},
"Microsoft.IdentityModel.Tokens/7.0.3": {
"dependencies": {
"Microsoft.IdentityModel.Logging": "7.0.3"
},
"runtime": {
"lib/net8.0/Microsoft.IdentityModel.Tokens.dll": {
"assemblyVersion": "7.0.3.0",
"fileVersion": "7.0.3.41017"
}
}
},
"Microsoft.IdentityModel.Tokens.Saml/7.0.3": {
"dependencies": {
"Microsoft.IdentityModel.Tokens": "7.0.3",
"Microsoft.IdentityModel.Xml": "7.0.3"
},
"runtime": {
"lib/net8.0/Microsoft.IdentityModel.Tokens.Saml.dll": {
"assemblyVersion": "7.0.3.0",
"fileVersion": "7.0.3.41017"
}
}
},
"Microsoft.IdentityModel.Xml/7.0.3": {
"dependencies": {
"Microsoft.IdentityModel.Tokens": "7.0.3"
},
"runtime": {
"lib/net8.0/Microsoft.IdentityModel.Xml.dll": {
"assemblyVersion": "7.0.3.0",
"fileVersion": "7.0.3.41017"
}
}
},
"System.IdentityModel.Tokens.Jwt/7.0.3": {
"dependencies": {
"Microsoft.IdentityModel.JsonWebTokens": "7.0.3",
"Microsoft.IdentityModel.Tokens": "7.0.3"
},
"runtime": {
"lib/net8.0/System.IdentityModel.Tokens.Jwt.dll": {
"assemblyVersion": "7.0.3.0",
"fileVersion": "7.0.3.41017"
}
}
}
}
},
"libraries": {
"maintenance/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Microsoft.AspNetCore.Authentication.WsFederation/8.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-0AzwWD4oIUQw0VcypaU0QloXR0pu3PguG/XKI1+scvVguYbiZv3LfSO6LEKgWnHhIIy0A5RXZiqC79Du5i1sSQ==",
"path": "microsoft.aspnetcore.authentication.wsfederation/8.0.0",
"hashPath": "microsoft.aspnetcore.authentication.wsfederation.8.0.0.nupkg.sha512"
},
"Microsoft.IdentityModel.Abstractions/7.0.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-cfPUWdjigLIRIJSKz3uaZxShgf86RVDXHC1VEEchj1gnY25akwPYpbrfSoIGDCqA9UmOMdlctq411+2pAViFow==",
"path": "microsoft.identitymodel.abstractions/7.0.3",
"hashPath": "microsoft.identitymodel.abstractions.7.0.3.nupkg.sha512"
},
"Microsoft.IdentityModel.JsonWebTokens/7.0.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-vxjHVZbMKD3rVdbvKhzAW+7UiFrYToUVm3AGmYfKSOAwyhdLl/ELX1KZr+FaLyyS5VReIzWRWJfbOuHM9i6ywg==",
"path": "microsoft.identitymodel.jsonwebtokens/7.0.3",
"hashPath": "microsoft.identitymodel.jsonwebtokens.7.0.3.nupkg.sha512"
},
"Microsoft.IdentityModel.Logging/7.0.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-b6GbGO+2LOTBEccHhqoJsOsmemG4A/MY+8H0wK/ewRhiG+DCYwEnucog1cSArPIY55zcn+XdZl0YEiUHkpDISQ==",
"path": "microsoft.identitymodel.logging/7.0.3",
"hashPath": "microsoft.identitymodel.logging.7.0.3.nupkg.sha512"
},
"Microsoft.IdentityModel.Protocols/7.0.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-BtwR+tctBYhPNygyZmt1Rnw74GFrJteW+1zcdIgyvBCjkek6cNwPPqRfdhzCv61i+lwyNomRi8+iI4QKd4YCKA==",
"path": "microsoft.identitymodel.protocols/7.0.3",
"hashPath": "microsoft.identitymodel.protocols.7.0.3.nupkg.sha512"
},
"Microsoft.IdentityModel.Protocols.WsFederation/7.0.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-y4iYbrH3bjNlQyaNeAOppk8x7Hc8THvBtiOZVxafrluvmsZXhv3mi8Ue1Ein5W4FvJZgIIkpR+7+NDD3gsGpfg==",
"path": "microsoft.identitymodel.protocols.wsfederation/7.0.3",
"hashPath": "microsoft.identitymodel.protocols.wsfederation.7.0.3.nupkg.sha512"
},
"Microsoft.IdentityModel.Tokens/7.0.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-wB+LlbDjhnJ98DULjmFepqf9eEMh/sDs6S6hFh68iNRHmwollwhxk+nbSSfpA5+j+FbRyNskoaY4JsY1iCOKCg==",
"path": "microsoft.identitymodel.tokens/7.0.3",
"hashPath": "microsoft.identitymodel.tokens.7.0.3.nupkg.sha512"
},
"Microsoft.IdentityModel.Tokens.Saml/7.0.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-R+zU08I9Xz1Mr6GLUioSUO7EndWi/qK2e+HLBBfNMPAk9oYqoQ1URhPz84MkIzJfIFsLmrUkiQmstQB3b0fa6w==",
"path": "microsoft.identitymodel.tokens.saml/7.0.3",
"hashPath": "microsoft.identitymodel.tokens.saml.7.0.3.nupkg.sha512"
},
"Microsoft.IdentityModel.Xml/7.0.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-R/EUU1vgf2mrOgKGD8n7D8Pv8UU4fEM9I6Nggn0G0t59ff/G1hb1UJHpUE8gTmi6fNBPCiXy5Xukc5A2x7kVrw==",
"path": "microsoft.identitymodel.xml/7.0.3",
"hashPath": "microsoft.identitymodel.xml.7.0.3.nupkg.sha512"
},
"System.IdentityModel.Tokens.Jwt/7.0.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-caEe+OpQNYNiyZb+DJpUVROXoVySWBahko2ooNfUcllxa9ZQUM8CgM/mDjP6AoFn6cQU9xMmG+jivXWub8cbGg==",
"path": "system.identitymodel.tokens.jwt/7.0.3",
"hashPath": "system.identitymodel.tokens.jwt.7.0.3.nupkg.sha512"
}
}
}
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,19 @@
{
"runtimeOptions": {
"tfm": "net8.0",
"frameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "8.0.0"
},
{
"name": "Microsoft.AspNetCore.App",
"version": "8.0.0"
}
],
"configProperties": {
"System.GC.Server": true,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+15
View File
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.WsFederation" Version="8.0.0" />
</ItemGroup>
</Project>
+22
View File
@@ -0,0 +1,22 @@
html {
font-size: 14px;
}
@media (min-width: 768px) {
html {
font-size: 16px;
}
}
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}
html {
position: relative;
min-height: 100%;
}
body {
margin-bottom: 60px;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

+4
View File
@@ -0,0 +1,4 @@
// Please see documentation at https://learn.microsoft.com/aspnet/core/client-side/bundling-and-minification
// for details on configuring this project to bundle and minify static web assets.
// Write your JavaScript code.
+22
View File
@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2011-2021 Twitter, Inc.
Copyright (c) 2011-2021 The Bootstrap Authors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+427
View File
@@ -0,0 +1,427 @@
/*!
* Bootstrap Reboot v5.1.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/
*,
*::before,
*::after {
box-sizing: border-box;
}
@media (prefers-reduced-motion: no-preference) {
:root {
scroll-behavior: smooth;
}
}
body {
margin: 0;
font-family: var(--bs-body-font-family);
font-size: var(--bs-body-font-size);
font-weight: var(--bs-body-font-weight);
line-height: var(--bs-body-line-height);
color: var(--bs-body-color);
text-align: var(--bs-body-text-align);
background-color: var(--bs-body-bg);
-webkit-text-size-adjust: 100%;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
hr {
margin: 1rem 0;
color: inherit;
background-color: currentColor;
border: 0;
opacity: 0.25;
}
hr:not([size]) {
height: 1px;
}
h6, h5, h4, h3, h2, h1 {
margin-top: 0;
margin-bottom: 0.5rem;
font-weight: 500;
line-height: 1.2;
}
h1 {
font-size: calc(1.375rem + 1.5vw);
}
@media (min-width: 1200px) {
h1 {
font-size: 2.5rem;
}
}
h2 {
font-size: calc(1.325rem + 0.9vw);
}
@media (min-width: 1200px) {
h2 {
font-size: 2rem;
}
}
h3 {
font-size: calc(1.3rem + 0.6vw);
}
@media (min-width: 1200px) {
h3 {
font-size: 1.75rem;
}
}
h4 {
font-size: calc(1.275rem + 0.3vw);
}
@media (min-width: 1200px) {
h4 {
font-size: 1.5rem;
}
}
h5 {
font-size: 1.25rem;
}
h6 {
font-size: 1rem;
}
p {
margin-top: 0;
margin-bottom: 1rem;
}
abbr[title],
abbr[data-bs-original-title] {
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
cursor: help;
-webkit-text-decoration-skip-ink: none;
text-decoration-skip-ink: none;
}
address {
margin-bottom: 1rem;
font-style: normal;
line-height: inherit;
}
ol,
ul {
padding-left: 2rem;
}
ol,
ul,
dl {
margin-top: 0;
margin-bottom: 1rem;
}
ol ol,
ul ul,
ol ul,
ul ol {
margin-bottom: 0;
}
dt {
font-weight: 700;
}
dd {
margin-bottom: 0.5rem;
margin-left: 0;
}
blockquote {
margin: 0 0 1rem;
}
b,
strong {
font-weight: bolder;
}
small {
font-size: 0.875em;
}
mark {
padding: 0.2em;
background-color: #fcf8e3;
}
sub,
sup {
position: relative;
font-size: 0.75em;
line-height: 0;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
a {
color: #0d6efd;
text-decoration: underline;
}
a:hover {
color: #0a58ca;
}
a:not([href]):not([class]), a:not([href]):not([class]):hover {
color: inherit;
text-decoration: none;
}
pre,
code,
kbd,
samp {
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: 1em;
direction: ltr /* rtl:ignore */;
unicode-bidi: bidi-override;
}
pre {
display: block;
margin-top: 0;
margin-bottom: 1rem;
overflow: auto;
font-size: 0.875em;
}
pre code {
font-size: inherit;
color: inherit;
word-break: normal;
}
code {
font-size: 0.875em;
color: #d63384;
word-wrap: break-word;
}
a > code {
color: inherit;
}
kbd {
padding: 0.2rem 0.4rem;
font-size: 0.875em;
color: #fff;
background-color: #212529;
border-radius: 0.2rem;
}
kbd kbd {
padding: 0;
font-size: 1em;
font-weight: 700;
}
figure {
margin: 0 0 1rem;
}
img,
svg {
vertical-align: middle;
}
table {
caption-side: bottom;
border-collapse: collapse;
}
caption {
padding-top: 0.5rem;
padding-bottom: 0.5rem;
color: #6c757d;
text-align: left;
}
th {
text-align: inherit;
text-align: -webkit-match-parent;
}
thead,
tbody,
tfoot,
tr,
td,
th {
border-color: inherit;
border-style: solid;
border-width: 0;
}
label {
display: inline-block;
}
button {
border-radius: 0;
}
button:focus:not(:focus-visible) {
outline: 0;
}
input,
button,
select,
optgroup,
textarea {
margin: 0;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
button,
select {
text-transform: none;
}
[role=button] {
cursor: pointer;
}
select {
word-wrap: normal;
}
select:disabled {
opacity: 1;
}
[list]::-webkit-calendar-picker-indicator {
display: none;
}
button,
[type=button],
[type=reset],
[type=submit] {
-webkit-appearance: button;
}
button:not(:disabled),
[type=button]:not(:disabled),
[type=reset]:not(:disabled),
[type=submit]:not(:disabled) {
cursor: pointer;
}
::-moz-focus-inner {
padding: 0;
border-style: none;
}
textarea {
resize: vertical;
}
fieldset {
min-width: 0;
padding: 0;
margin: 0;
border: 0;
}
legend {
float: left;
width: 100%;
padding: 0;
margin-bottom: 0.5rem;
font-size: calc(1.275rem + 0.3vw);
line-height: inherit;
}
@media (min-width: 1200px) {
legend {
font-size: 1.5rem;
}
}
legend + * {
clear: left;
}
::-webkit-datetime-edit-fields-wrapper,
::-webkit-datetime-edit-text,
::-webkit-datetime-edit-minute,
::-webkit-datetime-edit-hour-field,
::-webkit-datetime-edit-day-field,
::-webkit-datetime-edit-month-field,
::-webkit-datetime-edit-year-field {
padding: 0;
}
::-webkit-inner-spin-button {
height: auto;
}
[type=search] {
outline-offset: -2px;
-webkit-appearance: textfield;
}
/* rtl:raw:
[type="tel"],
[type="url"],
[type="email"],
[type="number"] {
direction: ltr;
}
*/
::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-color-swatch-wrapper {
padding: 0;
}
::file-selector-button {
font: inherit;
}
::-webkit-file-upload-button {
font: inherit;
-webkit-appearance: button;
}
output {
display: inline-block;
}
iframe {
border: 0;
}
summary {
display: list-item;
cursor: pointer;
}
progress {
vertical-align: baseline;
}
[hidden] {
display: none !important;
}
/*# sourceMappingURL=bootstrap-reboot.css.map */
File diff suppressed because one or more lines are too long
@@ -0,0 +1,8 @@
/*!
* Bootstrap Reboot v5.1.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:var(--bs-body-font-family);font-size:var(--bs-body-font-size);font-weight:var(--bs-body-font-weight);line-height:var(--bs-body-line-height);color:var(--bs-body-color);text-align:var(--bs-body-text-align);background-color:var(--bs-body-bg);-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-left:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:left}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:left;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:left}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}
/*# sourceMappingURL=bootstrap-reboot.min.css.map */
File diff suppressed because one or more lines are too long
+424
View File
@@ -0,0 +1,424 @@
/*!
* Bootstrap Reboot v5.1.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/
*,
*::before,
*::after {
box-sizing: border-box;
}
@media (prefers-reduced-motion: no-preference) {
:root {
scroll-behavior: smooth;
}
}
body {
margin: 0;
font-family: var(--bs-body-font-family);
font-size: var(--bs-body-font-size);
font-weight: var(--bs-body-font-weight);
line-height: var(--bs-body-line-height);
color: var(--bs-body-color);
text-align: var(--bs-body-text-align);
background-color: var(--bs-body-bg);
-webkit-text-size-adjust: 100%;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
hr {
margin: 1rem 0;
color: inherit;
background-color: currentColor;
border: 0;
opacity: 0.25;
}
hr:not([size]) {
height: 1px;
}
h6, h5, h4, h3, h2, h1 {
margin-top: 0;
margin-bottom: 0.5rem;
font-weight: 500;
line-height: 1.2;
}
h1 {
font-size: calc(1.375rem + 1.5vw);
}
@media (min-width: 1200px) {
h1 {
font-size: 2.5rem;
}
}
h2 {
font-size: calc(1.325rem + 0.9vw);
}
@media (min-width: 1200px) {
h2 {
font-size: 2rem;
}
}
h3 {
font-size: calc(1.3rem + 0.6vw);
}
@media (min-width: 1200px) {
h3 {
font-size: 1.75rem;
}
}
h4 {
font-size: calc(1.275rem + 0.3vw);
}
@media (min-width: 1200px) {
h4 {
font-size: 1.5rem;
}
}
h5 {
font-size: 1.25rem;
}
h6 {
font-size: 1rem;
}
p {
margin-top: 0;
margin-bottom: 1rem;
}
abbr[title],
abbr[data-bs-original-title] {
-webkit-text-decoration: underline dotted;
text-decoration: underline dotted;
cursor: help;
-webkit-text-decoration-skip-ink: none;
text-decoration-skip-ink: none;
}
address {
margin-bottom: 1rem;
font-style: normal;
line-height: inherit;
}
ol,
ul {
padding-right: 2rem;
}
ol,
ul,
dl {
margin-top: 0;
margin-bottom: 1rem;
}
ol ol,
ul ul,
ol ul,
ul ol {
margin-bottom: 0;
}
dt {
font-weight: 700;
}
dd {
margin-bottom: 0.5rem;
margin-right: 0;
}
blockquote {
margin: 0 0 1rem;
}
b,
strong {
font-weight: bolder;
}
small {
font-size: 0.875em;
}
mark {
padding: 0.2em;
background-color: #fcf8e3;
}
sub,
sup {
position: relative;
font-size: 0.75em;
line-height: 0;
vertical-align: baseline;
}
sub {
bottom: -0.25em;
}
sup {
top: -0.5em;
}
a {
color: #0d6efd;
text-decoration: underline;
}
a:hover {
color: #0a58ca;
}
a:not([href]):not([class]), a:not([href]):not([class]):hover {
color: inherit;
text-decoration: none;
}
pre,
code,
kbd,
samp {
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: 1em;
direction: ltr ;
unicode-bidi: bidi-override;
}
pre {
display: block;
margin-top: 0;
margin-bottom: 1rem;
overflow: auto;
font-size: 0.875em;
}
pre code {
font-size: inherit;
color: inherit;
word-break: normal;
}
code {
font-size: 0.875em;
color: #d63384;
word-wrap: break-word;
}
a > code {
color: inherit;
}
kbd {
padding: 0.2rem 0.4rem;
font-size: 0.875em;
color: #fff;
background-color: #212529;
border-radius: 0.2rem;
}
kbd kbd {
padding: 0;
font-size: 1em;
font-weight: 700;
}
figure {
margin: 0 0 1rem;
}
img,
svg {
vertical-align: middle;
}
table {
caption-side: bottom;
border-collapse: collapse;
}
caption {
padding-top: 0.5rem;
padding-bottom: 0.5rem;
color: #6c757d;
text-align: right;
}
th {
text-align: inherit;
text-align: -webkit-match-parent;
}
thead,
tbody,
tfoot,
tr,
td,
th {
border-color: inherit;
border-style: solid;
border-width: 0;
}
label {
display: inline-block;
}
button {
border-radius: 0;
}
button:focus:not(:focus-visible) {
outline: 0;
}
input,
button,
select,
optgroup,
textarea {
margin: 0;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
button,
select {
text-transform: none;
}
[role=button] {
cursor: pointer;
}
select {
word-wrap: normal;
}
select:disabled {
opacity: 1;
}
[list]::-webkit-calendar-picker-indicator {
display: none;
}
button,
[type=button],
[type=reset],
[type=submit] {
-webkit-appearance: button;
}
button:not(:disabled),
[type=button]:not(:disabled),
[type=reset]:not(:disabled),
[type=submit]:not(:disabled) {
cursor: pointer;
}
::-moz-focus-inner {
padding: 0;
border-style: none;
}
textarea {
resize: vertical;
}
fieldset {
min-width: 0;
padding: 0;
margin: 0;
border: 0;
}
legend {
float: right;
width: 100%;
padding: 0;
margin-bottom: 0.5rem;
font-size: calc(1.275rem + 0.3vw);
line-height: inherit;
}
@media (min-width: 1200px) {
legend {
font-size: 1.5rem;
}
}
legend + * {
clear: right;
}
::-webkit-datetime-edit-fields-wrapper,
::-webkit-datetime-edit-text,
::-webkit-datetime-edit-minute,
::-webkit-datetime-edit-hour-field,
::-webkit-datetime-edit-day-field,
::-webkit-datetime-edit-month-field,
::-webkit-datetime-edit-year-field {
padding: 0;
}
::-webkit-inner-spin-button {
height: auto;
}
[type=search] {
outline-offset: -2px;
-webkit-appearance: textfield;
}
[type="tel"],
[type="url"],
[type="email"],
[type="number"] {
direction: ltr;
}
::-webkit-search-decoration {
-webkit-appearance: none;
}
::-webkit-color-swatch-wrapper {
padding: 0;
}
::file-selector-button {
font: inherit;
}
::-webkit-file-upload-button {
font: inherit;
-webkit-appearance: button;
}
output {
display: inline-block;
}
iframe {
border: 0;
}
summary {
display: list-item;
cursor: pointer;
}
progress {
vertical-align: baseline;
}
[hidden] {
display: none !important;
}
/*# sourceMappingURL=bootstrap-reboot.rtl.css.map */
File diff suppressed because one or more lines are too long
@@ -0,0 +1,8 @@
/*!
* Bootstrap Reboot v5.1.0 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors
* Copyright 2011-2021 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/*,::after,::before{box-sizing:border-box}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}body{margin:0;font-family:var(--bs-body-font-family);font-size:var(--bs-body-font-size);font-weight:var(--bs-body-font-weight);line-height:var(--bs-body-line-height);color:var(--bs-body-color);text-align:var(--bs-body-text-align);background-color:var(--bs-body-bg);-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}hr{margin:1rem 0;color:inherit;background-color:currentColor;border:0;opacity:.25}hr:not([size]){height:1px}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem;font-weight:500;line-height:1.2}h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){h1{font-size:2.5rem}}h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){h2{font-size:2rem}}h3{font-size:calc(1.3rem + .6vw)}@media (min-width:1200px){h3{font-size:1.75rem}}h4{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){h4{font-size:1.5rem}}h5{font-size:1.25rem}h6{font-size:1rem}p{margin-top:0;margin-bottom:1rem}abbr[data-bs-original-title],abbr[title]{-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}ol,ul{padding-right:2rem}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-right:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:.875em}mark{padding:.2em;background-color:#fcf8e3}sub,sup{position:relative;font-size:.75em;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#0d6efd;text-decoration:underline}a:hover{color:#0a58ca}a:not([href]):not([class]),a:not([href]):not([class]):hover{color:inherit;text-decoration:none}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em;direction:ltr;unicode-bidi:bidi-override}pre{display:block;margin-top:0;margin-bottom:1rem;overflow:auto;font-size:.875em}pre code{font-size:inherit;color:inherit;word-break:normal}code{font-size:.875em;color:#d63384;word-wrap:break-word}a>code{color:inherit}kbd{padding:.2rem .4rem;font-size:.875em;color:#fff;background-color:#212529;border-radius:.2rem}kbd kbd{padding:0;font-size:1em;font-weight:700}figure{margin:0 0 1rem}img,svg{vertical-align:middle}table{caption-side:bottom;border-collapse:collapse}caption{padding-top:.5rem;padding-bottom:.5rem;color:#6c757d;text-align:right}th{text-align:inherit;text-align:-webkit-match-parent}tbody,td,tfoot,th,thead,tr{border-color:inherit;border-style:solid;border-width:0}label{display:inline-block}button{border-radius:0}button:focus:not(:focus-visible){outline:0}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,select{text-transform:none}[role=button]{cursor:pointer}select{word-wrap:normal}select:disabled{opacity:1}[list]::-webkit-calendar-picker-indicator{display:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}::-moz-focus-inner{padding:0;border-style:none}textarea{resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{float:right;width:100%;padding:0;margin-bottom:.5rem;font-size:calc(1.275rem + .3vw);line-height:inherit}@media (min-width:1200px){legend{font-size:1.5rem}}legend+*{clear:right}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-fields-wrapper,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-text,::-webkit-datetime-edit-year-field{padding:0}::-webkit-inner-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:textfield}[type=email],[type=number],[type=tel],[type=url]{direction:ltr}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-color-swatch-wrapper{padding:0}::file-selector-button{font:inherit}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}iframe{border:0}summary{display:list-item;cursor:pointer}progress{vertical-align:baseline}[hidden]{display:none!important}
/*# sourceMappingURL=bootstrap-reboot.rtl.min.css.map */
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More