diff --git a/.gitignore b/.gitignore
index c2a3f280..076f4ea6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,4 +7,5 @@ riderModule.iml
/*.sln.DotSettings.user
*/appsettings.Secret.yml
-*/tempkey.jwk
\ No newline at end of file
+*/tempkey.jwk
+/is4-rsa.pem
diff --git a/OAuthTest/Controllers/HomeController.cs b/OAuthTest/Controllers/HomeController.cs
index ec9df64d..5d230245 100644
--- a/OAuthTest/Controllers/HomeController.cs
+++ b/OAuthTest/Controllers/HomeController.cs
@@ -3,6 +3,7 @@
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
+using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
@@ -25,9 +26,26 @@ public IActionResult Index()
return View();
}
+ [HttpPost]
+ public IActionResult LogoutLocal()
+ {
+ return SignOut(new AuthenticationProperties {RedirectUri = Url.Action(nameof(LoggedOut))}, "Cookies");
+ }
+
+ [HttpPost]
+ public IActionResult LogoutProvider()
+ {
+ return SignOut(new AuthenticationProperties {RedirectUri = Url.Action(nameof(LoggedOut))}, "Cookies", "oidc");
+ }
+
+ public IActionResult LoggedOut()
+ {
+ return View();
+ }
+
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel {RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier});
}
-}
\ No newline at end of file
+}
diff --git a/OAuthTest/OAuthTest.csproj b/OAuthTest/OAuthTest.csproj
index c606b82b..98d02777 100644
--- a/OAuthTest/OAuthTest.csproj
+++ b/OAuthTest/OAuthTest.csproj
@@ -1,10 +1,11 @@
- net7.0
+ net10.0
-
+
+
diff --git a/OAuthTest/Program.cs b/OAuthTest/Program.cs
index dca925cd..9bec78ca 100644
--- a/OAuthTest/Program.cs
+++ b/OAuthTest/Program.cs
@@ -1,11 +1,6 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
-using Microsoft.Extensions.Logging;
namespace OAuthTest;
@@ -18,5 +13,12 @@ public static void Main(string[] args)
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
+ .ConfigureAppConfiguration((context, builder) =>
+ {
+ var env = context.HostingEnvironment;
+ builder.AddYamlFile("appsettings.yml", false, true);
+ builder.AddYamlFile($"appsettings.{env.EnvironmentName}.yml", true, true);
+ builder.AddYamlFile("appsettings.Secret.yml", true, true);
+ })
.ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup(); });
-}
\ No newline at end of file
+}
diff --git a/OAuthTest/Properties/launchSettings.json b/OAuthTest/Properties/launchSettings.json
index 69631ce1..7af185ab 100644
--- a/OAuthTest/Properties/launchSettings.json
+++ b/OAuthTest/Properties/launchSettings.json
@@ -1,9 +1,8 @@
-{
+{
"profiles": {
"OAuthTest": {
"commandName": "Project",
- "dotnetRunMessages": "true",
- "applicationUrl": "https://localhost:5002",
+ "dotnetRunMessages": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
diff --git a/OAuthTest/Startup.cs b/OAuthTest/Startup.cs
index 0ec8a6a9..28576ec8 100644
--- a/OAuthTest/Startup.cs
+++ b/OAuthTest/Startup.cs
@@ -1,3 +1,4 @@
+using System;
using System.IdentityModel.Tokens.Jwt;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
@@ -5,7 +6,6 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
-using Microsoft.IdentityModel.Protocols.OpenIdConnect;
namespace OAuthTest;
@@ -21,13 +21,14 @@ public Startup(IConfiguration configuration)
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
- services.AddHttpLogging(logging =>
- {
- logging.LoggingFields = HttpLoggingFields.All;
- //Write your code to configure the HttpLogging middleware here
- });
- JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();
-
+ var settings = Configuration.GetSection("OAuthTest").Get()
+ ?? throw new InvalidOperationException("Missing OAuthTest config section");
+
+ services.AddHttpLogging(logging => { logging.LoggingFields = settings.HttpLoggingFields; });
+
+ if (!settings.MapInboundClaims)
+ JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();
+
services.AddControllersWithViews();
services.AddAuthentication(options =>
@@ -39,19 +40,22 @@ public void ConfigureServices(IServiceCollection services)
.AddOpenIdConnect("oidc", options =>
{
options.SignInScheme = "Cookies";
-
- options.Authority = "https://localhost:5003";
- options.ClientId = "A";
- options.ClientSecret = "A";
-
- options.GetClaimsFromUserInfoEndpoint = true;
- options.ResponseType = OpenIdConnectResponseType.Code;
- //options.SaveTokens = true;
-
- options.Scope.Add("profile");
- options.Scope.Add("email");
- options.ResponseType = "code";
- options.UsePkce = true;
+
+ options.Authority = settings.Authority;
+ options.ClientId = settings.ClientId;
+ options.ClientSecret = settings.ClientSecret;
+
+ options.GetClaimsFromUserInfoEndpoint = settings.GetClaimsFromUserInfoEndpoint;
+ options.ResponseType = settings.ResponseType;
+ options.SaveTokens = settings.SaveTokens;
+ options.UsePkce = settings.UsePkce;
+ options.RequireHttpsMetadata = settings.RequireHttpsMetadata;
+ options.MapInboundClaims = settings.MapInboundClaims;
+
+ foreach (var scope in settings.Scopes)
+ {
+ options.Scope.Add(scope);
+ }
});
}
@@ -85,4 +89,22 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
pattern: "{controller=Home}/{action=Index}/{id?}");
});
}
-}
\ No newline at end of file
+}
+
+///
+/// Bound from the "OAuthTest" section of appsettings
+///
+public sealed class OAuthTestSettings
+{
+ public string Authority { get; set; } = "";
+ public string ClientId { get; set; } = "";
+ public string ClientSecret { get; set; } = "";
+ public string ResponseType { get; set; } = "code";
+ public bool UsePkce { get; set; } = true;
+ public bool GetClaimsFromUserInfoEndpoint { get; set; } = true;
+ public bool SaveTokens { get; set; }
+ public bool RequireHttpsMetadata { get; set; } = true;
+ public bool MapInboundClaims { get; set; }
+ public HttpLoggingFields HttpLoggingFields { get; set; } = HttpLoggingFields.All;
+ public string[] Scopes { get; set; } = Array.Empty();
+}
diff --git a/OAuthTest/Views/Home/Index.cshtml b/OAuthTest/Views/Home/Index.cshtml
index 056aa7fb..fd3e5abf 100644
--- a/OAuthTest/Views/Home/Index.cshtml
+++ b/OAuthTest/Views/Home/Index.cshtml
@@ -1,9 +1,35 @@
-@using Microsoft.AspNetCore.Authentication
+@using Microsoft.AspNetCore.Authentication
@{
ViewData["Title"] = "Home Page";
+
+ var tfa = User.FindFirst("two_factor_enabled")?.Value;
+ var amr = User.FindAll("amr").Select(c => c.Value).ToArray();
}
+
+
+
Security scope
+
+
+ - two_factor_enabled
+ -
+ @if (tfa == null)
+ {
+ not present
+ }
+ else
+ {
+ @tfa
+ }
+
+ - amr
+ - @(amr.Length == 0 ? "not present" : string.Join(", ", amr))
+
+
Claims
@@ -13,9 +39,9 @@
- @claim.Value
}
-
+
Properties
-
+
@foreach (var prop in (await Context.AuthenticateAsync()).Properties.Items)
{
@@ -23,4 +49,4 @@
- @prop.Value
}
-
\ No newline at end of file
+
diff --git a/OAuthTest/Views/Home/LoggedOut.cshtml b/OAuthTest/Views/Home/LoggedOut.cshtml
new file mode 100644
index 00000000..1cb325d6
--- /dev/null
+++ b/OAuthTest/Views/Home/LoggedOut.cshtml
@@ -0,0 +1,8 @@
+@{
+ ViewData["Title"] = "Logged out";
+}
+
+
+
Logged out
+
Log in again
+
diff --git a/OAuthTest/appsettings.Development.json b/OAuthTest/appsettings.Development.json
deleted file mode 100644
index 63ed6e14..00000000
--- a/OAuthTest/appsettings.Development.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "Logging": {
- "LogLevel": {
- "Default": "Information",
- "Microsoft": "Information",
- "Microsoft.Hosting.Lifetime": "Information"
- }
- }
-}
diff --git a/OAuthTest/appsettings.json b/OAuthTest/appsettings.json
deleted file mode 100644
index 214d63f9..00000000
--- a/OAuthTest/appsettings.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "Logging": {
- "LogLevel": {
- "Default": "Information",
- "Microsoft": "Information",
- "Microsoft.Hosting.Lifetime": "Information"
- }
- },
- "AllowedHosts": "*"
-}
diff --git a/OAuthTest/appsettings.yml b/OAuthTest/appsettings.yml
new file mode 100644
index 00000000..af256f3b
--- /dev/null
+++ b/OAuthTest/appsettings.yml
@@ -0,0 +1,28 @@
+Logging:
+ LogLevel:
+ Default: Information
+ Microsoft: Information
+ Microsoft.Hosting.Lifetime: Information
+
+AllowedHosts: "*"
+
+# Address this test app listens on (the OAuth callback is /signin-oidc).
+Urls: https://localhost:5002
+
+OAuthTest:
+ Authority: https://localhost:5003
+ ClientId: A
+ ClientSecret: A
+ ResponseType: code
+ UsePkce: true
+ GetClaimsFromUserInfoEndpoint: true
+ SaveTokens: false
+ RequireHttpsMetadata: true
+ # false = keep claim types exactly as sent by the server (no mapping to ClaimTypes.*).
+ MapInboundClaims: false
+ # Dump full HTTP request/response logging. One of the HttpLoggingFields values.
+ HttpLoggingFields: All
+ Scopes:
+ - profile
+ - email
+ - security
diff --git a/SS14.Auth.Shared/Data/AuthHash.cs b/SS14.Auth.Shared/Data/AuthHash.cs
index 83c4d22f..847eafea 100644
--- a/SS14.Auth.Shared/Data/AuthHash.cs
+++ b/SS14.Auth.Shared/Data/AuthHash.cs
@@ -17,6 +17,12 @@ public class AuthHash
public long? HwidId { get; set; }
[CanBeNull] public Hwid Hwid { get; set; }
+ ///
+ /// If true, the client granted the server it is connecting to permission to see security info about the user,
+ /// such as whether 2FA is enabled. Only released through hasJoined for this single connection attempt.
+ ///
+ public bool RequestSecurity { get; set; }
+
public DateTimeOffset Expires { get; set; }
[Required]
diff --git a/SS14.Auth.Shared/Data/Migrations/20261023174325_AuthHashRequestSecurity.Designer.cs b/SS14.Auth.Shared/Data/Migrations/20261023174325_AuthHashRequestSecurity.Designer.cs
new file mode 100644
index 00000000..14b33ab0
--- /dev/null
+++ b/SS14.Auth.Shared/Data/Migrations/20261023174325_AuthHashRequestSecurity.Designer.cs
@@ -0,0 +1,1785 @@
+//
+using System;
+using System.Net;
+using System.Text.Json;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+using SS14.Auth.Shared.Data;
+
+#nullable disable
+
+namespace SS14.Auth.Shared.Data.Migrations
+{
+ [DbContext(typeof(ApplicationDbContext))]
+ [Migration("20261023174325_AuthHashRequestSecurity")]
+ partial class AuthHashRequestSecurity
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "6.0.1")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResource", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("AllowedAccessTokenSigningAlgorithms")
+ .HasMaxLength(100)
+ .HasColumnType("character varying(100)");
+
+ b.Property("Created")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Description")
+ .HasMaxLength(1000)
+ .HasColumnType("character varying(1000)");
+
+ b.Property("DisplayName")
+ .HasMaxLength(200)
+ .HasColumnType("character varying(200)");
+
+ b.Property("Enabled")
+ .HasColumnType("boolean");
+
+ b.Property("LastAccessed")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("character varying(200)");
+
+ b.Property("NonEditable")
+ .HasColumnType("boolean");
+
+ b.Property("ShowInDiscoveryDocument")
+ .HasColumnType("boolean");
+
+ b.Property("Updated")
+ .HasColumnType("timestamp with time zone");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Name")
+ .IsUnique();
+
+ b.ToTable("ApiResources", "IS4");
+ });
+
+ modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceClaim", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ApiResourceId")
+ .HasColumnType("integer");
+
+ b.Property("Type")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("character varying(200)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ApiResourceId");
+
+ b.ToTable("ApiResourceClaims", "IS4");
+ });
+
+ modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceProperty", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ApiResourceId")
+ .HasColumnType("integer");
+
+ b.Property("Key")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("character varying(250)");
+
+ b.Property("Value")
+ .IsRequired()
+ .HasMaxLength(2000)
+ .HasColumnType("character varying(2000)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ApiResourceId");
+
+ b.ToTable("ApiResourceProperties", "IS4");
+ });
+
+ modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceScope", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ApiResourceId")
+ .HasColumnType("integer");
+
+ b.Property("Scope")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("character varying(200)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ApiResourceId");
+
+ b.ToTable("ApiResourceScopes", "IS4");
+ });
+
+ modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiResourceSecret", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ApiResourceId")
+ .HasColumnType("integer");
+
+ b.Property("Created")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Description")
+ .HasMaxLength(1000)
+ .HasColumnType("character varying(1000)");
+
+ b.Property("Expiration")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Type")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("character varying(250)");
+
+ b.Property("Value")
+ .IsRequired()
+ .HasMaxLength(4000)
+ .HasColumnType("character varying(4000)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ApiResourceId");
+
+ b.ToTable("ApiResourceSecrets", "IS4");
+ });
+
+ modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScope", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Description")
+ .HasMaxLength(1000)
+ .HasColumnType("character varying(1000)");
+
+ b.Property("DisplayName")
+ .HasMaxLength(200)
+ .HasColumnType("character varying(200)");
+
+ b.Property("Emphasize")
+ .HasColumnType("boolean");
+
+ b.Property("Enabled")
+ .HasColumnType("boolean");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("character varying(200)");
+
+ b.Property("Required")
+ .HasColumnType("boolean");
+
+ b.Property("ShowInDiscoveryDocument")
+ .HasColumnType("boolean");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Name")
+ .IsUnique();
+
+ b.ToTable("ApiScopes", "IS4");
+ });
+
+ modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeClaim", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ScopeId")
+ .HasColumnType("integer");
+
+ b.Property("Type")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("character varying(200)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ScopeId");
+
+ b.ToTable("ApiScopeClaims", "IS4");
+ });
+
+ modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ApiScopeProperty", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Key")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("character varying(250)");
+
+ b.Property("ScopeId")
+ .HasColumnType("integer");
+
+ b.Property("Value")
+ .IsRequired()
+ .HasMaxLength(2000)
+ .HasColumnType("character varying(2000)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ScopeId");
+
+ b.ToTable("ApiScopeProperties", "IS4");
+ });
+
+ modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.Client", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("AbsoluteRefreshTokenLifetime")
+ .HasColumnType("integer");
+
+ b.Property("AccessTokenLifetime")
+ .HasColumnType("integer");
+
+ b.Property("AccessTokenType")
+ .HasColumnType("integer");
+
+ b.Property("AllowAccessTokensViaBrowser")
+ .HasColumnType("boolean");
+
+ b.Property("AllowOfflineAccess")
+ .HasColumnType("boolean");
+
+ b.Property("AllowPlainTextPkce")
+ .HasColumnType("boolean");
+
+ b.Property("AllowRememberConsent")
+ .HasColumnType("boolean");
+
+ b.Property("AllowedIdentityTokenSigningAlgorithms")
+ .HasMaxLength(100)
+ .HasColumnType("character varying(100)");
+
+ b.Property("AlwaysIncludeUserClaimsInIdToken")
+ .HasColumnType("boolean");
+
+ b.Property("AlwaysSendClientClaims")
+ .HasColumnType("boolean");
+
+ b.Property("AuthorizationCodeLifetime")
+ .HasColumnType("integer");
+
+ b.Property("BackChannelLogoutSessionRequired")
+ .HasColumnType("boolean");
+
+ b.Property("BackChannelLogoutUri")
+ .HasMaxLength(2000)
+ .HasColumnType("character varying(2000)");
+
+ b.Property("ClientClaimsPrefix")
+ .HasMaxLength(200)
+ .HasColumnType("character varying(200)");
+
+ b.Property("ClientId")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("character varying(200)");
+
+ b.Property("ClientName")
+ .HasMaxLength(200)
+ .HasColumnType("character varying(200)");
+
+ b.Property("ClientUri")
+ .HasMaxLength(2000)
+ .HasColumnType("character varying(2000)");
+
+ b.Property("ConsentLifetime")
+ .HasColumnType("integer");
+
+ b.Property("Created")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Description")
+ .HasMaxLength(1000)
+ .HasColumnType("character varying(1000)");
+
+ b.Property("DeviceCodeLifetime")
+ .HasColumnType("integer");
+
+ b.Property("EnableLocalLogin")
+ .HasColumnType("boolean");
+
+ b.Property("Enabled")
+ .HasColumnType("boolean");
+
+ b.Property("FrontChannelLogoutSessionRequired")
+ .HasColumnType("boolean");
+
+ b.Property("FrontChannelLogoutUri")
+ .HasMaxLength(2000)
+ .HasColumnType("character varying(2000)");
+
+ b.Property("IdentityTokenLifetime")
+ .HasColumnType("integer");
+
+ b.Property("IncludeJwtId")
+ .HasColumnType("boolean");
+
+ b.Property("LastAccessed")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("LogoUri")
+ .HasMaxLength(2000)
+ .HasColumnType("character varying(2000)");
+
+ b.Property("NonEditable")
+ .HasColumnType("boolean");
+
+ b.Property("PairWiseSubjectSalt")
+ .HasMaxLength(200)
+ .HasColumnType("character varying(200)");
+
+ b.Property("ProtocolType")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("character varying(200)");
+
+ b.Property("RefreshTokenExpiration")
+ .HasColumnType("integer");
+
+ b.Property("RefreshTokenUsage")
+ .HasColumnType("integer");
+
+ b.Property("RequireClientSecret")
+ .HasColumnType("boolean");
+
+ b.Property("RequireConsent")
+ .HasColumnType("boolean");
+
+ b.Property("RequirePkce")
+ .HasColumnType("boolean");
+
+ b.Property("RequireRequestObject")
+ .HasColumnType("boolean");
+
+ b.Property("SlidingRefreshTokenLifetime")
+ .HasColumnType("integer");
+
+ b.Property("UpdateAccessTokenClaimsOnRefresh")
+ .HasColumnType("boolean");
+
+ b.Property("Updated")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("UserCodeType")
+ .HasMaxLength(100)
+ .HasColumnType("character varying(100)");
+
+ b.Property("UserSsoLifetime")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClientId")
+ .IsUnique();
+
+ b.ToTable("Clients", "IS4");
+ });
+
+ modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientClaim", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ClientId")
+ .HasColumnType("integer");
+
+ b.Property("Type")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("character varying(250)");
+
+ b.Property("Value")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("character varying(250)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClientId");
+
+ b.ToTable("ClientClaims", "IS4");
+ });
+
+ modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientCorsOrigin", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ClientId")
+ .HasColumnType("integer");
+
+ b.Property("Origin")
+ .IsRequired()
+ .HasMaxLength(150)
+ .HasColumnType("character varying(150)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClientId");
+
+ b.ToTable("ClientCorsOrigins", "IS4");
+ });
+
+ modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientGrantType", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ClientId")
+ .HasColumnType("integer");
+
+ b.Property("GrantType")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("character varying(250)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClientId");
+
+ b.ToTable("ClientGrantTypes", "IS4");
+ });
+
+ modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientIdPRestriction", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ClientId")
+ .HasColumnType("integer");
+
+ b.Property("Provider")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("character varying(200)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClientId");
+
+ b.ToTable("ClientIdPRestrictions", "IS4");
+ });
+
+ modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientPostLogoutRedirectUri", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ClientId")
+ .HasColumnType("integer");
+
+ b.Property("PostLogoutRedirectUri")
+ .IsRequired()
+ .HasMaxLength(2000)
+ .HasColumnType("character varying(2000)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClientId");
+
+ b.ToTable("ClientPostLogoutRedirectUris", "IS4");
+ });
+
+ modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientProperty", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ClientId")
+ .HasColumnType("integer");
+
+ b.Property("Key")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("character varying(250)");
+
+ b.Property("Value")
+ .IsRequired()
+ .HasMaxLength(2000)
+ .HasColumnType("character varying(2000)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClientId");
+
+ b.ToTable("ClientProperties", "IS4");
+ });
+
+ modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientRedirectUri", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ClientId")
+ .HasColumnType("integer");
+
+ b.Property("RedirectUri")
+ .IsRequired()
+ .HasMaxLength(2000)
+ .HasColumnType("character varying(2000)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClientId");
+
+ b.ToTable("ClientRedirectUris", "IS4");
+ });
+
+ modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientScope", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ClientId")
+ .HasColumnType("integer");
+
+ b.Property("Scope")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("character varying(200)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClientId");
+
+ b.ToTable("ClientScopes", "IS4");
+ });
+
+ modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.ClientSecret", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ClientId")
+ .HasColumnType("integer");
+
+ b.Property("Created")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Description")
+ .HasMaxLength(2000)
+ .HasColumnType("character varying(2000)");
+
+ b.Property("Expiration")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Type")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("character varying(250)");
+
+ b.Property("Value")
+ .IsRequired()
+ .HasMaxLength(4000)
+ .HasColumnType("character varying(4000)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClientId");
+
+ b.ToTable("ClientSecrets", "IS4");
+ });
+
+ modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.DeviceFlowCodes", b =>
+ {
+ b.Property("UserCode")
+ .HasMaxLength(200)
+ .HasColumnType("character varying(200)");
+
+ b.Property("ClientId")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("character varying(200)");
+
+ b.Property("CreationTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Data")
+ .IsRequired()
+ .HasMaxLength(50000)
+ .HasColumnType("character varying(50000)");
+
+ b.Property("Description")
+ .HasMaxLength(200)
+ .HasColumnType("character varying(200)");
+
+ b.Property("DeviceCode")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("character varying(200)");
+
+ b.Property("Expiration")
+ .IsRequired()
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("SessionId")
+ .HasMaxLength(100)
+ .HasColumnType("character varying(100)");
+
+ b.Property("SubjectId")
+ .HasMaxLength(200)
+ .HasColumnType("character varying(200)");
+
+ b.HasKey("UserCode");
+
+ b.HasIndex("DeviceCode")
+ .IsUnique();
+
+ b.HasIndex("Expiration");
+
+ b.ToTable("DeviceCodes", "IS4");
+ });
+
+ modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResource", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Created")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Description")
+ .HasMaxLength(1000)
+ .HasColumnType("character varying(1000)");
+
+ b.Property("DisplayName")
+ .HasMaxLength(200)
+ .HasColumnType("character varying(200)");
+
+ b.Property("Emphasize")
+ .HasColumnType("boolean");
+
+ b.Property("Enabled")
+ .HasColumnType("boolean");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("character varying(200)");
+
+ b.Property("NonEditable")
+ .HasColumnType("boolean");
+
+ b.Property("Required")
+ .HasColumnType("boolean");
+
+ b.Property("ShowInDiscoveryDocument")
+ .HasColumnType("boolean");
+
+ b.Property("Updated")
+ .HasColumnType("timestamp with time zone");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Name")
+ .IsUnique();
+
+ b.ToTable("IdentityResources", "IS4");
+ });
+
+ modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceClaim", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("IdentityResourceId")
+ .HasColumnType("integer");
+
+ b.Property("Type")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("character varying(200)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("IdentityResourceId");
+
+ b.ToTable("IdentityResourceClaims", "IS4");
+ });
+
+ modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.IdentityResourceProperty", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("IdentityResourceId")
+ .HasColumnType("integer");
+
+ b.Property("Key")
+ .IsRequired()
+ .HasMaxLength(250)
+ .HasColumnType("character varying(250)");
+
+ b.Property("Value")
+ .IsRequired()
+ .HasMaxLength(2000)
+ .HasColumnType("character varying(2000)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("IdentityResourceId");
+
+ b.ToTable("IdentityResourceProperties", "IS4");
+ });
+
+ modelBuilder.Entity("IdentityServer4.EntityFramework.Entities.PersistedGrant", b =>
+ {
+ b.Property("Key")
+ .HasMaxLength(200)
+ .HasColumnType("character varying(200)");
+
+ b.Property("ClientId")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("character varying(200)");
+
+ b.Property("ConsumedTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("CreationTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Data")
+ .IsRequired()
+ .HasMaxLength(50000)
+ .HasColumnType("character varying(50000)");
+
+ b.Property("Description")
+ .HasMaxLength(200)
+ .HasColumnType("character varying(200)");
+
+ b.Property("Expiration")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("SessionId")
+ .HasMaxLength(100)
+ .HasColumnType("character varying(100)");
+
+ b.Property("SubjectId")
+ .HasMaxLength(200)
+ .HasColumnType("character varying(200)");
+
+ b.Property("Type")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("character varying(50)");
+
+ b.HasKey("Key");
+
+ b.HasIndex("Expiration");
+
+ b.HasIndex("SubjectId", "ClientId", "Type");
+
+ b.HasIndex("SubjectId", "SessionId", "Type");
+
+ b.ToTable("PersistedGrants", "IS4");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("FriendlyName")
+ .HasColumnType("text");
+
+ b.Property("Xml")
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("DataProtectionKeys");
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ClaimType")
+ .HasColumnType("text");
+
+ b.Property("ClaimValue")
+ .HasColumnType("text");
+
+ b.Property("RoleId")
+ .HasColumnType("uuid");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetRoleClaims", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ClaimType")
+ .HasColumnType("text");
+
+ b.Property("ClaimValue")
+ .HasColumnType("text");
+
+ b.Property("UserId")
+ .HasColumnType("uuid");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserClaims", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b =>
+ {
+ b.Property("LoginProvider")
+ .HasColumnType("text");
+
+ b.Property("ProviderKey")
+ .HasColumnType("text");
+
+ b.Property("ProviderDisplayName")
+ .HasColumnType("text");
+
+ b.Property("UserId")
+ .HasColumnType("uuid");
+
+ b.HasKey("LoginProvider", "ProviderKey");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("AspNetUserLogins", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b =>
+ {
+ b.Property("UserId")
+ .HasColumnType("uuid");
+
+ b.Property("RoleId")
+ .HasColumnType("uuid");
+
+ b.HasKey("UserId", "RoleId");
+
+ b.HasIndex("RoleId");
+
+ b.ToTable("AspNetUserRoles", (string)null);
+ });
+
+ modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b =>
+ {
+ b.Property("UserId")
+ .HasColumnType("uuid");
+
+ b.Property("LoginProvider")
+ .HasColumnType("text");
+
+ b.Property("Name")
+ .HasColumnType("text");
+
+ b.Property("Value")
+ .HasColumnType("text");
+
+ b.HasKey("UserId", "LoginProvider", "Name");
+
+ b.ToTable("AspNetUserTokens", (string)null);
+ });
+
+ modelBuilder.Entity("SS14.Auth.Shared.Data.AccountLog", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Actor")
+ .HasColumnType("uuid");
+
+ b.Property("ActorAddress")
+ .HasColumnType("inet");
+
+ b.Property("Data")
+ .IsRequired()
+ .HasColumnType("jsonb");
+
+ b.Property("SpaceUserId")
+ .HasColumnType("uuid");
+
+ b.Property("Time")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Type")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SpaceUserId");
+
+ b.ToTable("AccountLogs");
+ });
+
+ modelBuilder.Entity("SS14.Auth.Shared.Data.AuthHash", b =>
+ {
+ b.Property("AuthHashId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("AuthHashId"));
+
+ b.Property("Expires")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Hash")
+ .IsRequired()
+ .HasColumnType("bytea");
+
+ b.Property("HwidId")
+ .HasColumnType("bigint");
+
+ b.Property("RequestSecurity")
+ .HasColumnType("boolean");
+
+ b.Property("SpaceUserId")
+ .HasColumnType("uuid");
+
+ b.HasKey("AuthHashId");
+
+ b.HasIndex("HwidId");
+
+ b.HasIndex("SpaceUserId");
+
+ b.HasIndex("Hash", "SpaceUserId")
+ .IsUnique();
+
+ b.ToTable("AuthHashes");
+ });
+
+ modelBuilder.Entity("SS14.Auth.Shared.Data.BurnerEmail", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Domain")
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Domain")
+ .IsUnique();
+
+ b.ToTable("BurnerEmails");
+ });
+
+ modelBuilder.Entity("SS14.Auth.Shared.Data.Hwid", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ClientData")
+ .IsRequired()
+ .HasColumnType("bytea");
+
+ b.Property("TypeCode")
+ .HasColumnType("integer");
+
+ b.Property("Value")
+ .IsRequired()
+ .HasColumnType("bytea");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClientData")
+ .IsUnique();
+
+ b.ToTable("Hwids");
+ });
+
+ modelBuilder.Entity("SS14.Auth.Shared.Data.HwidUser", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("FirstSeen")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("HwidId")
+ .HasColumnType("bigint");
+
+ b.Property("SpaceUserId")
+ .HasColumnType("uuid");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SpaceUserId");
+
+ b.HasIndex("HwidId", "SpaceUserId")
+ .IsUnique();
+
+ b.ToTable("HwidUsers");
+ });
+
+ modelBuilder.Entity("SS14.Auth.Shared.Data.LoginSession", b =>
+ {
+ b.Property("LoginSessionId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LoginSessionId"));
+
+ b.Property("Expires")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("SpaceUserId")
+ .HasColumnType("uuid");
+
+ b.Property("Token")
+ .IsRequired()
+ .HasColumnType("bytea");
+
+ b.HasKey("LoginSessionId");
+
+ b.HasIndex("SpaceUserId");
+
+ b.HasIndex("Token")
+ .IsUnique();
+
+ b.ToTable("ActiveSessions");
+ });
+
+ modelBuilder.Entity("SS14.Auth.Shared.Data.PastAccountName", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ChangeTime")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("PastName")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("SpaceUserId")
+ .HasColumnType("uuid");
+
+ b.HasKey("Id");
+
+ b.HasIndex("SpaceUserId");
+
+ b.ToTable("PastAccountNames");
+ });
+
+ modelBuilder.Entity("SS14.Auth.Shared.Data.PatreonWebhookLog", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Content")
+ .HasColumnType("jsonb");
+
+ b.Property("Time")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Trigger")
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("PatreonWebhookLogs");
+ });
+
+ modelBuilder.Entity("SS14.Auth.Shared.Data.Patron", b =>
+ {
+ b.Property