Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net7.0;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net8.0;netstandard2.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
1 change: 0 additions & 1 deletion SecurityService.Database/SecurityService.Database.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.3" />
<PackageReference Include="Shared" Version="2025.5.4" />
</ItemGroup>
<ItemGroup>
Expand Down
7 changes: 0 additions & 7 deletions SecurityService.sln
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SecurityService.OpenIdConne
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SecurityService.SqlServerMigrations", "SecurityService.SqlServerMigrations\SecurityService.SqlServerMigrations.csproj", "{06507A50-DFDF-4842-9BA4-F70F194741D7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SecurityService.MySqlMigrations", "SecurityService.MySqlMigrations\SecurityService.MySqlMigrations.csproj", "{701F392A-0D5B-4FDD-8135-DA037ECA7A8F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SecurityService.UserInterface", "SecurityService.UserInterface\SecurityService.UserInterface.csproj", "{DA8C3E4B-5ACB-4941-B05F-EC46D1D60CD7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecurityService.IntegrationTesting.Helpers", "SecurityService.IntegrationTesting.Helpers\SecurityService.IntegrationTesting.Helpers.csproj", "{A06BD7CA-6CAF-48DE-BF78-D3772927951B}"
Expand Down Expand Up @@ -85,10 +83,6 @@ Global
{06507A50-DFDF-4842-9BA4-F70F194741D7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{06507A50-DFDF-4842-9BA4-F70F194741D7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{06507A50-DFDF-4842-9BA4-F70F194741D7}.Release|Any CPU.Build.0 = Release|Any CPU
{701F392A-0D5B-4FDD-8135-DA037ECA7A8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{701F392A-0D5B-4FDD-8135-DA037ECA7A8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{701F392A-0D5B-4FDD-8135-DA037ECA7A8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{701F392A-0D5B-4FDD-8135-DA037ECA7A8F}.Release|Any CPU.Build.0 = Release|Any CPU
{DA8C3E4B-5ACB-4941-B05F-EC46D1D60CD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DA8C3E4B-5ACB-4941-B05F-EC46D1D60CD7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DA8C3E4B-5ACB-4941-B05F-EC46D1D60CD7}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -113,7 +107,6 @@ Global
{28C72B39-1803-49D7-9289-C71A620E4EF1} = {62BD199E-BDB7-4D33-92E4-3FE97D5EBC91}
{5BAEC61F-39FF-4197-A73A-A8A8B5BDFE86} = {62BD199E-BDB7-4D33-92E4-3FE97D5EBC91}
{06507A50-DFDF-4842-9BA4-F70F194741D7} = {FBA324D4-A2B7-4539-B63E-AF254EA7DA50}
{701F392A-0D5B-4FDD-8135-DA037ECA7A8F} = {FBA324D4-A2B7-4539-B63E-AF254EA7DA50}
{DA8C3E4B-5ACB-4941-B05F-EC46D1D60CD7} = {FBA324D4-A2B7-4539-B63E-AF254EA7DA50}
{A06BD7CA-6CAF-48DE-BF78-D3772927951B} = {62BD199E-BDB7-4D33-92E4-3FE97D5EBC91}
EndGlobalSection
Expand Down
45 changes: 5 additions & 40 deletions SecurityService/Common/StartupExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,48 +18,13 @@ public static class StartupExtensions
public static IIdentityServerBuilder AddIdentityServerStorage(this IIdentityServerBuilder builder,
String configurationConnectionString,
String persistedGrantStoreConenctionString,
String authenticationConenctionString)
{
if (Startup.IsSqlServer)
{
builder.AddConfigurationStore<ConfigurationDbContext>(options =>
{
options.ConfigureDbContext =
c => c.UseSqlServer(configurationConnectionString, sqlOptions => sqlOptions.MigrationsAssembly("SecurityService.SqlServerMigrations"));
});

builder.AddOperationalStore<PersistedGrantDbContext>(options =>
{
options.ConfigureDbContext =
c => c.UseSqlServer(persistedGrantStoreConenctionString,
sqlOptions => sqlOptions.MigrationsAssembly("SecurityService.SqlServerMigrations"));
});

builder.Services.AddDbContext<AuthenticationDbContext>(builder => builder.UseSqlServer(authenticationConenctionString,
sqlOptions => sqlOptions.MigrationsAssembly("SecurityService.SqlServerMigrations")));
}
else if (Startup.IsMySql)
{
ServerVersion serverVersion = ServerVersion.Parse("8.0.27");

builder.AddConfigurationStore<ConfigurationDbContext>(options =>
{
options.ConfigureDbContext = c => c.UseMySql(configurationConnectionString,
serverVersion,
sqlOptions => sqlOptions.MigrationsAssembly("SecurityService.MySqlMigrations")); });

builder.AddOperationalStore<PersistedGrantDbContext>(options =>
{
options.ConfigureDbContext = c => c.UseMySql(persistedGrantStoreConenctionString,
serverVersion,
sqlOptions => sqlOptions.MigrationsAssembly("SecurityService.MySqlMigrations"));
});
String authenticationConenctionString) {
builder.AddConfigurationStore<ConfigurationDbContext>(options => { options.ConfigureDbContext = c => c.UseSqlServer(configurationConnectionString, sqlOptions => sqlOptions.MigrationsAssembly("SecurityService.SqlServerMigrations")); });

builder.Services.AddDbContext<AuthenticationDbContext>(builder => builder.UseMySql(authenticationConenctionString,
serverVersion,
sqlOptions => sqlOptions.MigrationsAssembly("SecurityService.MySqlMigrations")));
}
builder.AddOperationalStore<PersistedGrantDbContext>(options => { options.ConfigureDbContext = c => c.UseSqlServer(persistedGrantStoreConenctionString, sqlOptions => sqlOptions.MigrationsAssembly("SecurityService.SqlServerMigrations")); });

builder.Services.AddDbContext<AuthenticationDbContext>(builder => builder.UseSqlServer(authenticationConenctionString, sqlOptions => sqlOptions.MigrationsAssembly("SecurityService.SqlServerMigrations")));

return builder;
}

Expand Down
2 changes: 1 addition & 1 deletion SecurityService/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM stuartferguson/txnprocbase AS base
FROM stuartferguson/txnprocbase:2024.8.1 AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
Expand Down
4 changes: 1 addition & 3 deletions SecurityService/SecurityService.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.14" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.14" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.3" />


<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />

<PackageReference Include="Shared.Results.Web" Version="2025.5.4" />
Expand All @@ -50,7 +49,6 @@
<ProjectReference Include="..\SecurityService.BusinessLogic\SecurityService.BusinessLogic.csproj" />
<ProjectReference Include="..\SecurityService.Database\SecurityService.Database.csproj" />
<ProjectReference Include="..\SecurityService.DataTransferObjects\SecurityService.DataTransferObjects.csproj" />
<ProjectReference Include="..\SecurityService.MySqlMigrations\SecurityService.MySqlMigrations.csproj" />
<ProjectReference Include="..\SecurityService.SqlServerMigrations\SecurityService.SqlServerMigrations.csproj" />
<ProjectReference Include="..\SecurityService.UserInterface\SecurityService.UserInterface.csproj" />
</ItemGroup>
Expand Down
25 changes: 0 additions & 25 deletions SecurityService/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,23 +67,6 @@ public Startup(IWebHostEnvironment webHostEnvironment)
/// </value>
public static IConfigurationRoot Configuration { get; set; }

/// <summary>
/// Gets a value indicating whether this instance is my SQL.
/// </summary>
/// <value>
/// <c>true</c> if this instance is my SQL; otherwise, <c>false</c>.
/// </value>
public static Boolean IsMySql => string.Compare(Startup.GetDatabaseEngine, "MySql", StringComparison.InvariantCultureIgnoreCase) == 0;

/// <summary>
/// Gets a value indicating whether this instance is SQL server.
/// </summary>
/// <value>
/// <c>true</c> if this instance is SQL server; otherwise, <c>false</c>.
/// </value>
public static Boolean IsSqlServer =>
Startup.GetDatabaseEngine == null || string.Compare(Startup.GetDatabaseEngine, "SqlServer", StringComparison.InvariantCultureIgnoreCase) == 0;

/// <summary>
/// Gets or sets the hosting environment.
/// </summary>
Expand All @@ -92,14 +75,6 @@ public Startup(IWebHostEnvironment webHostEnvironment)
/// </value>
public static IWebHostEnvironment WebHostEnvironment { get; set; }

/// <summary>
/// Gets the get database engine.
/// </summary>
/// <value>
/// The get database engine.
/// </value>
private static String GetDatabaseEngine => ConfigurationReader.GetValue("AppSettings", "DatabaseEngine");

#endregion

#region Methods
Expand Down
7 changes: 0 additions & 7 deletions SecurityService/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,10 @@
}
},
"ConnectionStrings": {
// Sql Server
"PersistedGrantDbContext": "server=127.0.0.1;database=PersistedGrantStore;user id=sa;password=Sc0tland;Encrypt=false",
"ConfigurationDbContext": "server=127.0.0.1;database=Configuration;user id=sa;password=Sc0tland;Encrypt=false",
"AuthenticationDbContext": "server=127.0.0.1;database=Authentication;user id=sa;password=Sc0tland;Encrypt=false"

// MySql
//"PersistedGrantDbContext": "server=127.0.0.1;userid=root;password=sp1ttal;database=PersistedGrantStore;",
//"ConfigurationDbContext": "server=127.0.0.1;userid=root;password=sp1ttal;database=Configuration;",
//"AuthenticationDbContext": "server=127.0.0.1;userid=root;password=sp1ttal;database=Authentication;"
},
"AppSettings": {
"DatabaseEngine": "SqlServer"
}
}
Loading