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
5 changes: 0 additions & 5 deletions .github/workflows/buildwindowsimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ jobs:
steps:
- uses: actions/checkout@v2.3.4

- name: Install NET 9
uses: actions/setup-dotnet@v4.0.1
with:
dotnet-version: '9.0.x'

- name: Get the version
id: get_version
uses: battila7/get-version-action@v2
Expand Down
175 changes: 39 additions & 136 deletions .github/workflows/createrelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
types: [published]

jobs:
buildlinux:
build:
name: "Release"
env:
ASPNETCORE_ENVIRONMENT: "Production"
Expand All @@ -14,11 +14,6 @@

steps:
- uses: actions/checkout@v2.3.4

- name: Install NET 9
uses: actions/setup-dotnet@v4.0.1
with:
dotnet-version: '9.0.x'

- name: Get the version
id: get_version
Expand Down Expand Up @@ -51,15 +46,15 @@

- name: Publish API
if: ${{ github.event.release.prerelease == false }}
run: dotnet publish "SecurityService\SecurityService.csproj" --configuration Release --output publishOutput -r linux-x64 --self-contained
run: dotnet publish "SecurityService\SecurityService.csproj" --configuration Release --output publishOutput -r win-x64 --self-contained

- name: Build Release Package
run: |
cd /home/runner/work/SecurityService/SecurityService/publishOutput
zip -r ../securityservice.zip ./*

- name: Upload the artifact
uses: actions/upload-artifact@v4.4.0
uses: actions/upload-artifact@v4
with:
name: securityservice
path: securityservice.zip
Expand All @@ -73,161 +68,69 @@
dotnet nuget push Nugets/SecurityService.IntegrationTesting.Helpers.${{ steps.get_version.outputs.VERSION }}.nupkg --api-key ${{ secrets.PRIVATEFEED_APIKEY }} --source ${{ secrets.PRIVATEFEED_URL }} --skip-duplicate

deploystaging:
runs-on: [stagingserver, linux]
needs: buildlinux
runs-on: [stagingserver, windows]
needs: build
environment: staging
name: "Deploy to Staging"

steps:
- name: Download the artifact
uses: actions/download-artifact@v4.1.8
with:
name: securityservice
path: /tmp/securityservice # Download to a temporary directory

- name: Remove existing service (if applicable)
- name: Remove existing Windows service
run: |
SERVICE_NAME="securityservice"
if systemctl is-active --quiet "$SERVICE_NAME"; then
echo "Stopping existing service..."
sudo systemctl stop "$SERVICE_NAME"
fi
if systemctl is-enabled --quiet "$SERVICE_NAME"; then
echo "Disabling existing service..."
sudo systemctl disable "$SERVICE_NAME"
fi
if [ -f "/etc/systemd/system/${SERVICE_NAME}.service" ]; then
echo "Removing existing service unit file..."
sudo rm "/etc/systemd/system/${SERVICE_NAME}.service"
sudo systemctl daemon-reload
fi

$serviceName = "Transaction Processing - Security Service"
# Check if the service exists
if (Get-Service -Name $serviceName -ErrorAction SilentlyContinue) {
Stop-Service -Name $serviceName
sc.exe delete $serviceName
}

- name: Unzip the files
run: |
sudo mkdir -p /opt/txnproc/transactionprocessing/securityservice
sudo unzip -o /tmp/securityservice/securityservice.zip -d /opt/txnproc/transactionprocessing/securityservice

# IMPORTANT: Add a step to ensure the .NET runtime is installed on the server
# This assumes it's not already there. If your base image already has it, you can skip this.
- name: Install .NET Runtime
run: |
# Example for Ubuntu. Adjust based on your .NET version (e.g., 8.0, 7.0)
# and if you need the SDK or just the runtime.
# This uses Microsoft's package repository for the latest versions.
wget https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
sudo apt update
sudo apt install -y aspnetcore-runtime-9.0

- name: Install and Start as a Linux service
Expand-Archive -Path securityservice.zip -DestinationPath "C:\txnproc\transactionprocessing\securityservice" -Force

- name: Install as a Windows service
run: |
SERVICE_NAME="securityservice"
# The WorkingDirectory is crucial for .NET apps to find appsettings.json and other files
WORKING_DIRECTORY="/opt/txnproc/transactionprocessing/securityservice"
DLL_NAME="SecurityService.dll" # Your application's DLL
SERVICE_DESCRIPTION="Transaction Processing - Security Service"

# Create a systemd service file
echo "[Unit]" | sudo tee /etc/systemd/system/${SERVICE_NAME}.service
echo "Description=${SERVICE_DESCRIPTION}" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service
echo "After=network.target" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service
echo "" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service
echo "[Service]" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service
# IMPORTANT: Use 'dotnet' to run your DLL
echo "ExecStart=/usr/bin/dotnet ${WORKING_DIRECTORY}/${DLL_NAME}" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service
echo "WorkingDirectory=${WORKING_DIRECTORY}" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service
echo "Restart=always" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service
echo "User=youruser" # IMPORTANT: Change to a dedicated, less privileged user
echo "Group=yourgroup" # IMPORTANT: Change to a dedicated, less privileged group
echo "Environment=ASPNETCORE_ENVIRONMENT=Production" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service # Example
echo "" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service
echo "[Install]" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service
echo "WantedBy=multi-user.target" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service

# Reload systemd, enable, and start the service
sudo systemctl daemon-reload
sudo systemctl enable "$SERVICE_NAME"
sudo systemctl start "$SERVICE_NAME"
sudo systemctl status "$SERVICE_NAME" --no-pager # For debugging/verification
$serviceName = "Transaction Processing - Security Service"
$servicePath = "C:\txnproc\transactionprocessing\securityservice\SecurityService.exe"

New-Service -Name $serviceName -BinaryPathName $servicePath -Description $serviceName -DisplayName $serviceName -StartupType Automatic
Start-Service -Name $serviceName

deployproduction:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
runs-on: [productionserver, linux]
needs: [buildlinux, deploystaging]
runs-on: [productionserver, windows]
needs: [build, deploystaging]
environment: production
name: "Deploy to Production"

steps:
- name: Download the artifact
uses: actions/download-artifact@v4.1.8
with:
name: securityservice
path: /tmp/securityservice # Download to a temporary directory

- name: Remove existing service (if applicable)
- name: Remove existing Windows service
run: |
SERVICE_NAME="securityservice"
if systemctl is-active --quiet "$SERVICE_NAME"; then
echo "Stopping existing service..."
sudo systemctl stop "$SERVICE_NAME"
fi
if systemctl is-enabled --quiet "$SERVICE_NAME"; then
echo "Disabling existing service..."
sudo systemctl disable "$SERVICE_NAME"
fi
if [ -f "/etc/systemd/system/${SERVICE_NAME}.service" ]; then
echo "Removing existing service unit file..."
sudo rm "/etc/systemd/system/${SERVICE_NAME}.service"
sudo systemctl daemon-reload
fi

$serviceName = "Transaction Processing - Security Service"
# Check if the service exists
if (Get-Service -Name $serviceName -ErrorAction SilentlyContinue) {
Stop-Service -Name $serviceName
sc.exe delete $serviceName
}

- name: Unzip the files
run: |
sudo mkdir -p /opt/txnproc/transactionprocessing/securityservice
sudo unzip -o /tmp/securityservice/securityservice.zip -d /opt/txnproc/transactionprocessing/securityservice

# IMPORTANT: Add a step to ensure the .NET runtime is installed on the server
# This assumes it's not already there. If your base image already has it, you can skip this.
- name: Install .NET Runtime
run: |
# Example for Ubuntu. Adjust based on your .NET version (e.g., 8.0, 7.0)
# and if you need the SDK or just the runtime.
# This uses Microsoft's package repository for the latest versions.
wget https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
sudo apt update
sudo apt install -y aspnetcore-runtime-9.0

- name: Install and Start as a Linux service
Expand-Archive -Path securityservice.zip -DestinationPath "C:\txnproc\transactionprocessing\securityservice" -Force

- name: Install as a Windows service
run: |
SERVICE_NAME="securityservice"
# The WorkingDirectory is crucial for .NET apps to find appsettings.json and other files
WORKING_DIRECTORY="/opt/txnproc/transactionprocessing/securityservice"
DLL_NAME="SecurityService.dll" # Your application's DLL
SERVICE_DESCRIPTION="Transaction Processing - Security Service"

# Create a systemd service file
echo "[Unit]" | sudo tee /etc/systemd/system/${SERVICE_NAME}.service
echo "Description=${SERVICE_DESCRIPTION}" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service
echo "After=network.target" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service
echo "" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service
echo "[Service]" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service
# IMPORTANT: Use 'dotnet' to run your DLL
echo "ExecStart=/usr/bin/dotnet ${WORKING_DIRECTORY}/${DLL_NAME}" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service
echo "WorkingDirectory=${WORKING_DIRECTORY}" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service
echo "Restart=always" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service
echo "User=youruser" # IMPORTANT: Change to a dedicated, less privileged user
echo "Group=yourgroup" # IMPORTANT: Change to a dedicated, less privileged group
echo "Environment=ASPNETCORE_ENVIRONMENT=Production" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service # Example
echo "" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service
echo "[Install]" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service
echo "WantedBy=multi-user.target" | sudo tee -a /etc/systemd/system/${SERVICE_NAME}.service

# Reload systemd, enable, and start the service
sudo systemctl daemon-reload
sudo systemctl enable "$SERVICE_NAME"
sudo systemctl start "$SERVICE_NAME"
sudo systemctl status "$SERVICE_NAME" --no-pager # For debugging/verification
sudo systemctl start "$SERVICE_NAME"
sudo systemctl status "$SERVICE_NAME" --no-pager # For debugging/verification
$serviceName = "Transaction Processing - Security Service"
$servicePath = "C:\txnproc\transactionprocessing\securityservice\SecurityService.exe"

New-Service -Name $serviceName -BinaryPathName $servicePath -Description $serviceName -DisplayName $serviceName -StartupType Automatic
Start-Service -Name $serviceName
18 changes: 4 additions & 14 deletions .github/workflows/pullrequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ jobs:
steps:
- uses: actions/checkout@v2.3.4

- name: Install NET 9
uses: actions/setup-dotnet@v4.0.1
with:
dotnet-version: '9.0.x'

- name: Trust Root Certificate
run: |
certPath="$GITHUB_WORKSPACE/Certificates/aspnetapp-root-cert.pfx"
Expand Down Expand Up @@ -58,7 +53,7 @@ jobs:
run: |
dotnet test "SecurityService.IntegrationTests\SecurityService.IntegrationTests.csproj" --filter Category=PRTest

- uses: actions/upload-artifact@v4.4.0
- uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: nonuilogs
Expand Down Expand Up @@ -92,11 +87,6 @@ jobs:
openssl pkcs12 -in "$certPath" -out temp.pem -nodes -password "pass:$password"
sudo cp temp.pem /usr/local/share/ca-certificates/aspnetapp-web-api.crt
sudo update-ca-certificates

- name: Install NET 9
uses: actions/setup-dotnet@v4.0.1
with:
dotnet-version: '9.0.x'

- name: Restore Nuget Packages
run: dotnet restore SecurityService.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }}
Expand All @@ -115,7 +105,7 @@ jobs:
run: |
dotnet test "SecurityService.OpenIdConnect.IntegrationTests\SecurityService.OpenIdConnect.IntegrationTests.csproj" --filter Category=PRTest

- uses: actions/upload-artifact@v4.4.0
- uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: firefoxlogs
Expand Down Expand Up @@ -172,7 +162,7 @@ jobs:
# run: |
# dotnet test "SecurityService.OpenIdConnect.IntegrationTests\SecurityService.OpenIdConnect.IntegrationTests.csproj" --filter Category=PRTest

# - uses: actions/upload-artifact@v4.4.0
# - uses: actions/upload-artifact@v4
# if: ${{ failure() }}
# with:
# name: chromelogs
Expand Down Expand Up @@ -231,7 +221,7 @@ jobs:
# run: |
# dotnet test "SecurityService.OpenIdConnect.IntegrationTests\SecurityService.OpenIdConnect.IntegrationTests.csproj" --filter Category=PRTest

# - uses: actions/upload-artifact@v4.4.0
# - uses: actions/upload-artifact@v4
# if: ${{ failure() }}
# with:
# name: edgelogs
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/pushtomaster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ jobs:
with:
fetch-depth: 0

- name: Install NET 9
uses: actions/setup-dotnet@v4.0.1
with:
dotnet-version: '9.0.x'

- name: Restore Nuget Packages
run: dotnet restore SecurityService.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }}

Expand Down
26 changes: 13 additions & 13 deletions SecurityService.BusinessLogic/SecurityService.BusinessLogic.csproj
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Duende.IdentityServer" Version="7.3.2" />
<PackageReference Include="Duende.IdentityServer.EntityFramework.Storage" Version="7.3.2" />
<PackageReference Include="Duende.IdentityServer.Storage" Version="7.3.2" />
<PackageReference Include="MediatR" Version="13.1.0" />
<PackageReference Include="MessagingService.Client" Version="2025.10.2-build106" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="9.0.10" />
<PackageReference Include="Duende.IdentityServer" Version="7.4.2" />
<PackageReference Include="Duende.IdentityServer.EntityFramework.Storage" Version="7.4.2" />
<PackageReference Include="Duende.IdentityServer.Storage" Version="7.4.2" />
<PackageReference Include="MediatR" Version="14.0.0" />
<PackageReference Include="MessagingService.Client" Version="2025.12.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="10.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.3.1" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="9.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.10" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.10" />
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="9.0.10" />
<PackageReference Include="Shared" Version="2025.11.11" />
<PackageReference Include="Shared.Results" Version="2025.11.11" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="10.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="10.0.0" />
<PackageReference Include="Shared" Version="2025.12.1" />
<PackageReference Include="Shared.Results" Version="2025.12.1" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions SecurityService.Client/SecurityService.Client.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net9.0</TargetFrameworks>
<TargetFrameworks>net10.0</TargetFrameworks>
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);IncludeP2PAssets</TargetsForTfmSpecificBuildOutput>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ClientProxyBase" Version="2025.11.11" />
<PackageReference Include="Shared.Results" Version="2025.11.11" />
<PackageReference Include="ClientProxyBase" Version="2025.12.1" />
<PackageReference Include="Shared.Results" Version="2025.12.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net9.0</TargetFrameworks>
<TargetFrameworks>net10.0</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
Loading
Loading