From f6a3aa9c46b4078500039b672ffa0680462df7dd Mon Sep 17 00:00:00 2001 From: juliangiebel Date: Sun, 10 Aug 2025 22:12:57 +0200 Subject: [PATCH 01/43] Remove IdentityServer4 packages --- SS14.Auth.Shared/SS14.Auth.Shared.csproj | 1 - SS14.Web/SS14.Web.csproj | 3 --- 2 files changed, 4 deletions(-) diff --git a/SS14.Auth.Shared/SS14.Auth.Shared.csproj b/SS14.Auth.Shared/SS14.Auth.Shared.csproj index 6acfab5..5fe2e54 100644 --- a/SS14.Auth.Shared/SS14.Auth.Shared.csproj +++ b/SS14.Auth.Shared/SS14.Auth.Shared.csproj @@ -25,7 +25,6 @@ - diff --git a/SS14.Web/SS14.Web.csproj b/SS14.Web/SS14.Web.csproj index 1b5c315..8e9acc8 100644 --- a/SS14.Web/SS14.Web.csproj +++ b/SS14.Web/SS14.Web.csproj @@ -6,9 +6,6 @@ - - - From 555ded668af503ed9d0e5c9d1dea8cd4d5ed5f52 Mon Sep 17 00:00:00 2001 From: juliangiebel Date: Sun, 10 Aug 2025 22:47:49 +0200 Subject: [PATCH 02/43] Comment out IdentityServer4 code --- SS14.Auth.Shared/Data/ApplicationDbContext.cs | 21 +++--- SS14.Auth.Shared/Data/UserOAuthClient.cs | 11 +-- .../Areas/Admin/Pages/Clients/Client.cshtml | 23 ++++--- .../Admin/Pages/Clients/Client.cshtml.cs | 25 +++---- .../Admin/Pages/Clients/ConfirmDelete.cshtml | 10 +-- .../Pages/Clients/ConfirmDelete.cshtml.cs | 19 ++--- .../Areas/Admin/Pages/Clients/Index.cshtml | 7 +- .../Areas/Admin/Pages/Clients/Index.cshtml.cs | 26 ++++--- .../Identity/Pages/Account/Consent.cshtml | 22 +++--- .../Identity/Pages/Account/Consent.cshtml.cs | 35 +++++----- .../Pages/Account/Manage/Developer.cshtml | 3 +- .../Pages/Account/Manage/Developer.cshtml.cs | 6 +- .../Manage/OAuthApps/ConfirmDelete.cshtml | 4 +- .../Manage/OAuthApps/ConfirmDelete.cshtml.cs | 18 ++--- .../Account/Manage/OAuthApps/Create.cshtml.cs | 13 ++-- .../Account/Manage/OAuthApps/Manage.cshtml | 12 ++-- .../Account/Manage/OAuthApps/Manage.cshtml.cs | 69 +++++++++---------- SS14.Web/PersonalDataCollector.cs | 6 +- SS14.Web/Startup.cs | 30 ++++---- 19 files changed, 179 insertions(+), 181 deletions(-) diff --git a/SS14.Auth.Shared/Data/ApplicationDbContext.cs b/SS14.Auth.Shared/Data/ApplicationDbContext.cs index 3b3b507..de20479 100644 --- a/SS14.Auth.Shared/Data/ApplicationDbContext.cs +++ b/SS14.Auth.Shared/Data/ApplicationDbContext.cs @@ -1,19 +1,16 @@ using System; -using System.Threading.Tasks; -using IdentityServer4.EntityFramework.Entities; -using IdentityServer4.EntityFramework.Extensions; -using IdentityServer4.EntityFramework.Interfaces; -using IdentityServer4.EntityFramework.Options; using Microsoft.AspNetCore.DataProtection.EntityFrameworkCore; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; namespace SS14.Auth.Shared.Data; +// TODO: Replace identityserver4 code in this file + public class ApplicationDbContext : IdentityDbContext, - IDataProtectionKeyContext, - IConfigurationDbContext, - IPersistedGrantDbContext + IDataProtectionKeyContext //, + //IConfigurationDbContext, + //IPersistedGrantDbContext { public ApplicationDbContext(DbContextOptions options) : base(options) @@ -73,7 +70,7 @@ protected override void OnModelCreating(ModelBuilder builder) .HasIndex(h => new { h.HwidId, h.SpaceUserId }) .IsUnique(); - var cfgStoreOptions = new ConfigurationStoreOptions + /*var cfgStoreOptions = new ConfigurationStoreOptions { IdentityResource = new TableConfiguration("IdentityResources", "IS4"), IdentityResourceClaim = new TableConfiguration("IdentityResourceClaims", "IS4"), @@ -103,7 +100,7 @@ protected override void OnModelCreating(ModelBuilder builder) { PersistedGrants = new TableConfiguration("PersistedGrants", "IS4"), DeviceFlowCodes = new TableConfiguration("DeviceCodes", "IS4"), - }); + });*/ } public DbSet ActiveSessions { get; set; } @@ -120,7 +117,7 @@ protected override void OnModelCreating(ModelBuilder builder) public DbSet HwidUsers { get; set; } // IS4 configuration. - public DbSet Clients { get; set; } + /*public DbSet Clients { get; set; } public DbSet ClientSecrets { get; set; } public DbSet ClientCorsOrigins { get; set; } public DbSet IdentityResources { get; set; } @@ -134,5 +131,5 @@ protected override void OnModelCreating(ModelBuilder builder) Task IPersistedGrantDbContext.SaveChangesAsync() { return base.SaveChangesAsync(); - } + }*/ } diff --git a/SS14.Auth.Shared/Data/UserOAuthClient.cs b/SS14.Auth.Shared/Data/UserOAuthClient.cs index 79258b6..70ffa70 100644 --- a/SS14.Auth.Shared/Data/UserOAuthClient.cs +++ b/SS14.Auth.Shared/Data/UserOAuthClient.cs @@ -1,16 +1,17 @@  using System; -using IdentityServer4.EntityFramework.Entities; namespace SS14.Auth.Shared.Data; public sealed class UserOAuthClient { public int UserOAuthClientId { get; set; } - + public Guid SpaceUserId { get; set; } public int ClientId { get; set; } - + public SpaceUser SpaceUser { get; set; } - public Client Client { get; set; } -} \ No newline at end of file + // TODO: Replace identityserver4 code in this file + + //public Client Client { get; set; } +} diff --git a/SS14.Web/Areas/Admin/Pages/Clients/Client.cshtml b/SS14.Web/Areas/Admin/Pages/Clients/Client.cshtml index 9a927ff..af46e15 100644 --- a/SS14.Web/Areas/Admin/Pages/Clients/Client.cshtml +++ b/SS14.Web/Areas/Admin/Pages/Clients/Client.cshtml @@ -1,15 +1,17 @@ @page @model SS14.Web.Areas.Admin.Pages.Clients.Client - +@* Oh god this file is going to be horrible to refactor for openiddict *@ @{ - ViewData["Title"] = $"OAuth Client: {Model.Title}"; + // TODO: Replace identityserver4 code in this file + + //ViewData["Title"] = $"OAuth Client: {Model.Title}"; } @@ -313,7 +315,7 @@ - +@**@
Secrets
@@ -328,7 +330,7 @@ - @foreach (var secret in Model.Secrets) + @*@foreach (var secret in Model.Secrets) { @secret.Description @@ -337,12 +339,12 @@
- - } + + }*@ @@ -354,10 +356,11 @@ - + @**@
Actions
- +@* Delete +*@ diff --git a/SS14.Web/Areas/Admin/Pages/Clients/Client.cshtml.cs b/SS14.Web/Areas/Admin/Pages/Clients/Client.cshtml.cs index 4f5ab11..25f79a5 100644 --- a/SS14.Web/Areas/Admin/Pages/Clients/Client.cshtml.cs +++ b/SS14.Web/Areas/Admin/Pages/Clients/Client.cshtml.cs @@ -1,19 +1,12 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Security.Cryptography; -using System.Threading.Tasks; -using IdentityServer4.EntityFramework.Entities; -using IdentityServer4.Models; +using System.ComponentModel.DataAnnotations; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.EntityFrameworkCore; using SS14.Auth.Shared.Data; -using DbClient = IdentityServer4.EntityFramework.Entities.Client; namespace SS14.Web.Areas.Admin.Pages.Clients; +// TODO: Replace identityserver4 code in this file + public class Client : PageModel { private readonly ApplicationDbContext _dbContext; @@ -28,11 +21,11 @@ public Client(ApplicationDbContext dbContext) [TempData] public string StatusMessage { get; set; } - public DbClient DbClient { get; set; } + //public DbClient DbClient { get; set; } - public string Title => DbClient.ClientName ?? DbClient.ClientId; + //public string Title => DbClient.ClientName ?? DbClient.ClientId; - public IEnumerable Secrets { get; set; } + //public IEnumerable Secrets { get; set; } public sealed class CreateSecretModel { @@ -99,7 +92,7 @@ public sealed class InputModel public string AllowedCorsOrigins { get; set; } } - public async Task OnGetAsync(int id) + /*public async Task OnGetAsync(int id) { DbClient = await _dbContext.Clients .Include(c => c.RedirectUris) @@ -321,5 +314,5 @@ public async Task OnPostDeleteSecretAsync(int secret) StatusMessage = "Secret deleted."; return RedirectToPage(new {id = dbSecret.ClientId}); - } -} \ No newline at end of file + }*/ +} diff --git a/SS14.Web/Areas/Admin/Pages/Clients/ConfirmDelete.cshtml b/SS14.Web/Areas/Admin/Pages/Clients/ConfirmDelete.cshtml index b03013c..4bbb077 100644 --- a/SS14.Web/Areas/Admin/Pages/Clients/ConfirmDelete.cshtml +++ b/SS14.Web/Areas/Admin/Pages/Clients/ConfirmDelete.cshtml @@ -2,18 +2,20 @@ @model SS14.Web.Areas.Admin.Pages.Clients.ConfirmDelete @{ - ViewData["Title"] = $"Delete {Model.Title}?"; + // TODO: Replace identityserver4 code in this file + + //ViewData["Title"] = $"Delete {Model.Title}?"; }
- -
\ No newline at end of file + @**@ + diff --git a/SS14.Web/Areas/Admin/Pages/Clients/ConfirmDelete.cshtml.cs b/SS14.Web/Areas/Admin/Pages/Clients/ConfirmDelete.cshtml.cs index 7f2921f..9c904a1 100644 --- a/SS14.Web/Areas/Admin/Pages/Clients/ConfirmDelete.cshtml.cs +++ b/SS14.Web/Areas/Admin/Pages/Clients/ConfirmDelete.cshtml.cs @@ -3,10 +3,11 @@ using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.EntityFrameworkCore; using SS14.Auth.Shared.Data; -using DbClient = IdentityServer4.EntityFramework.Entities.Client; namespace SS14.Web.Areas.Admin.Pages.Clients; +// TODO: Replace identityserver4 code in this file + public class ConfirmDelete : PageModel { private readonly ApplicationDbContext _dbContext; @@ -16,24 +17,24 @@ public ConfirmDelete(ApplicationDbContext dbContext) _dbContext = dbContext; } - public DbClient DbClient { get; set; } - public string Title => DbClient.ClientName ?? DbClient.ClientId; - + //public DbClient DbClient { get; set; } + //public string Title => DbClient.ClientName ?? DbClient.ClientId; + public async Task OnGetAsync(int id) { - DbClient = await _dbContext.Clients.FirstOrDefaultAsync(c => c.Id == id); + /*DbClient = await _dbContext.Clients.FirstOrDefaultAsync(c => c.Id == id); if (DbClient == null) { return NotFound("Unknown client"); - } + }*/ return Page(); } public async Task OnPostDeleteAsync(int id) { - DbClient = await _dbContext.Clients.FirstOrDefaultAsync(c => c.Id == id); + /*DbClient = await _dbContext.Clients.FirstOrDefaultAsync(c => c.Id == id); if (DbClient == null) { @@ -44,7 +45,7 @@ public async Task OnPostDeleteAsync(int id) await _dbContext.SaveChangesAsync(); - TempData["StatusMessage"] = "OAuth client deleted"; + TempData["StatusMessage"] = "OAuth client deleted";*/ return RedirectToPage("./Index"); } -} \ No newline at end of file +} diff --git a/SS14.Web/Areas/Admin/Pages/Clients/Index.cshtml b/SS14.Web/Areas/Admin/Pages/Clients/Index.cshtml index 83e71c1..59809c2 100644 --- a/SS14.Web/Areas/Admin/Pages/Clients/Index.cshtml +++ b/SS14.Web/Areas/Admin/Pages/Clients/Index.cshtml @@ -2,6 +2,7 @@ @model SS14.Web.Areas.Admin.Pages.Clients.Index @{ + // TODO: Replace identityserver4 code in this file ViewData["Title"] = "OAuth Clients"; }