Skip to content
Closed
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
4 changes: 2 additions & 2 deletions .azuredevops/pipelines/build-dcr-func.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ pool:

steps:
- task: UseDotNet@2
displayName: 'Install .NET 8 SDK'
displayName: 'Install .NET 10 SDK'
inputs:
packageType: 'sdk'
version: '8.0.x'
version: '10.0.x'
performMultiLevelLookup: true

- script: |
Expand Down
4 changes: 2 additions & 2 deletions .azuredevops/pipelines/build-dh-func.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ pool:

steps:
- task: UseDotNet@2
displayName: 'Install .NET 8 SDK'
displayName: 'Install .NET 10 SDK'
inputs:
packageType: 'sdk'
version: '8.0.x'
version: '10.0.x'
performMultiLevelLookup: true

- script: |
Expand Down
4 changes: 2 additions & 2 deletions .azuredevops/pipelines/build-no-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ steps:
artifact: Container Images

- task: UseDotNet@2
displayName: 'Use .NET 6 sdk'
displayName: 'Use .NET 10 sdk'
condition: always()
inputs:
packageType: sdk
version: '8.0.x'
version: '10.0.x'
performMultiLevelLookup: true

- task: CmdLine@2
Expand Down
39 changes: 20 additions & 19 deletions .azuredevops/pipelines/build-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,24 @@ jobs:
inputs:
command: images

# Run unit tests
- script: |
docker compose --file $(dockerComposeDirectory)/docker-compose.UnitTests.yml up --abort-on-container-exit --exit-code-from mock-data-recipient-unit-tests
displayName: Unit Tests - Up
condition: always()

# Remove unit tests
- script: |
docker compose --file $(dockerComposeDirectory)/docker-compose.UnitTests.yml down
displayName: 'Unit Tests - Down'
condition: always()
## Refer to #96438, the SQL Unit tests have been broken for a long time and have now been included but not been fixed (out of scope)
# # Run unit tests
# - script: |
# docker compose --file $(dockerComposeDirectory)/docker-compose.UnitTests.yml up --abort-on-container-exit --exit-code-from mock-data-recipient-unit-tests
# displayName: Unit Tests - Up
# condition: always()

# # Remove unit tests
# - script: |
# docker compose --file $(dockerComposeDirectory)/docker-compose.UnitTests.yml down
# displayName: 'Unit Tests - Down'
# condition: always()

# # Publish mock-data-recipient unit tests results
# - publish: $(dockerComposeDirectory)/_temp/mock-data-recipient-unit-tests/testresults
# displayName: Publish unit tests
# condition: always()
# artifact: Mock-Data-Recipient - Unit tests

# Run integration tests
- script: |
Expand Down Expand Up @@ -207,12 +214,6 @@ jobs:
path: $(build.artifactstagingdirectory)/mock-data-recipient.image.tar
artifact: Container Images

# Publish mock-data-recipient unit tests results
- publish: $(dockerComposeDirectory)/_temp/mock-data-recipient-unit-tests/testresults
displayName: Publish unit tests
condition: always()
artifact: Mock-Data-Recipient - Unit tests

# Run trx formatter to output .MD and .CSV
- script: |
docker run \
Expand Down Expand Up @@ -244,11 +245,11 @@ jobs:
artifact: Mock-Data-Recipient - E2E tests

- task: UseDotNet@2
displayName: 'Use .NET 8 sdk'
displayName: 'Use .NET 10 sdk'
condition: always()
inputs:
packageType: sdk
version: '8.0.x'
version: '10.0.x'
performMultiLevelLookup: true

- task: CmdLine@2
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ on:

env:
buildConfiguration: 'Release'
buildRuntime: 'win-x64'
buildRuntime: 'linux-x64'
runEnvironment: 'Release'
ASPNETCORE_ENVIRONMENT: 'Release'
DOTNET_SYSTEM_NET_HTTP_SOCKETSHTTPHANDLER_SKIPSERVERCERTIFICATEVALIDATION: 'true'

jobs:
build-and-test:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sonarcloud-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,5 @@ jobs:
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"ConsumerDataRight_mock-data-recipient" /o:"consumerdataright" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
dotnet build .\source\DataRecipient.sln
dotnet build .\source\DataRecipient.slnx
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [3.1.0] - 2026-09-30
### Changed
- Migrated from .NET 8 to .NET 10
- Migrated xUnit from v2 to v3
- Updated NuGet packages

## [3.0.5] - 2026-07-08
### Changed
- Updated nuget package versions
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![Consumer Data Right Logo](./cdr-logo.png?raw=true)

[![Consumer Data Standards v1.34.0](https://img.shields.io/badge/Consumer%20Data%20Standards-v1.34.0-blue.svg)](https://consumerdatastandardsaustralia.github.io/standards-archives/standards-1.34.0/#introduction)
[![Consumer Data Standards v1.36.0](https://img.shields.io/badge/Consumer%20Data%20Standards-v1.36.0-blue.svg)](https://consumerdatastandardsaustralia.github.io/standards-archives/standards-1.36.0/#introduction)
[![made-with-dotnet](https://img.shields.io/badge/Made%20with-.NET-1f425Ff.svg)](https://dotnet.microsoft.com/)
[![made-with-csharp](https://img.shields.io/badge/Made%20with-C%23-1f425Ff.svg)](https://docs.microsoft.com/en-us/dotnet/csharp/)
[![MIT License](https://img.shields.io/github/license/ConsumerDataRight/mock-data-recipient)](./LICENSE)
Expand All @@ -13,7 +13,7 @@ This repository contains a mock implementation of a Data Recipient and is offere

## Mock Data Recipient - Alignment
The Mock Data Recipient in this release:
* aligns to [v1.34.0](https://consumerdatastandardsaustralia.github.io/standards-archives/standards-1.34.0/#introduction) of the [Consumer Data Standards](https://consumerdatastandardsaustralia.github.io/standards-archives/standards-1.34.0/#introduction);
* aligns to [v1.36.0](https://consumerdatastandardsaustralia.github.io/standards-archives/standards-1.36.0/#introduction) of the [Consumer Data Standards](https://consumerdatastandardsaustralia.github.io/standards-archives/standards-1.34.0/#introduction);
* can connect to and complete authentication against both [FAPI 1.0 Migration Phase 2 and Phase 3](https://consumerdatastandardsaustralia.github.io/standards/#authentication-flows) compliant data holders.

## Getting Started
Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Visit our [Responsible disclosure of security vulnerabilities policy](https://ww

| Version | Supported |
| ------- | ------------------ |
| 3.0.x | :white_check_mark: |
| 3.x.x | :white_check_mark: |
| 2.x.x | :x: |
| 1.x.x | :x: |

Expand Down
1 change: 0 additions & 1 deletion Source/CDR.DCR/CDR.DCR.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage.Queues" />
<PackageReference Include="Microsoft.Data.SqlClient" />
<PackageReference Include="Microsoft.Extensions.Logging"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CDR.DataRecipient.Repository.SQL\CDR.DataRecipient.Repository.SQL.csproj" />
Expand Down
4 changes: 2 additions & 2 deletions Source/CDR.DCR/DCR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ public DynamicClientRegistrationFunction(ILogger<DynamicClientRegistrationFuncti
//get the certs
_logger.LogInformation("Loading the client certificate...");
byte[] clientCertBytes = Convert.FromBase64String(_options.Client_Certificate);
X509Certificate2 cclientCertificate = new(clientCertBytes, _options.Client_Certificate_Password, X509KeyStorageFlags.MachineKeySet);
X509Certificate2 cclientCertificate = X509CertificateLoader.LoadPkcs12(clientCertBytes, _options.Client_Certificate_Password, X509KeyStorageFlags.MachineKeySet);
_logger.LogInformation("Client certificate loaded: {thumbprint}", cclientCertificate.Thumbprint);


_logger.LogInformation("Loading the signing certificate...");
byte[] signCertBytes = Convert.FromBase64String(_options.Signing_Certificate);
_signingCertificate = new(signCertBytes, _options.Signing_Certificate_Password, X509KeyStorageFlags.MachineKeySet);
_signingCertificate = X509CertificateLoader.LoadPkcs12(signCertBytes, _options.Signing_Certificate_Password, X509KeyStorageFlags.MachineKeySet);
_logger.LogInformation("Signing certificate loaded: {thumbprint}", _signingCertificate.Thumbprint);
}

Expand Down
4 changes: 2 additions & 2 deletions Source/CDR.DCR/DCRHttpClientHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public DcrHttpClientHandler(
logger.LogInformation("Loading the client certificate...");

byte[] clientCertBytes = Convert.FromBase64String(dcrOptions.Client_Certificate);
X509Certificate2 clientCertificate = new(clientCertBytes, dcrOptions.Client_Certificate_Password, X509KeyStorageFlags.MachineKeySet);
X509Certificate2 clientCertificate = X509CertificateLoader.LoadPkcs12(clientCertBytes, dcrOptions.Client_Certificate_Password, X509KeyStorageFlags.MachineKeySet);
logger.LogInformation("Client certificate loaded: {thumbprint}", clientCertificate.Thumbprint);


Expand All @@ -28,4 +28,4 @@ public DcrHttpClientHandler(
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Diagnostics;
using System.IdentityModel.Tokens.Jwt;
using System.Net.Http.Headers;
using System.Threading;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
Expand Down Expand Up @@ -130,7 +131,7 @@ private async Task ExtractRequestProperties(HttpContext context)
{
context.Request.EnableBuffering();
await using var requestStream = this._recyclableMemoryStreamManager.GetStream();
await context.Request.Body.CopyToAsync(requestStream);
await context.Request.Body.CopyToAsync(requestStream, context.RequestAborted);

this._requestBody = this.ReadStreamInChunks(requestStream);
context.Request.Body.Position = 0;
Expand Down Expand Up @@ -227,7 +228,7 @@ private async Task ExtractResponseProperties(HttpContext httpContext)
this._elapsedTime = sw.ElapsedMilliseconds.ToString();

responseBody.Seek(0, SeekOrigin.Begin);
this._responseBody = await new StreamReader(responseBody).ReadToEndAsync();
this._responseBody = await new StreamReader(responseBody).ReadToEndAsync(CancellationToken.None);
responseBody.Seek(0, SeekOrigin.Begin);

IEnumerable<string> keyValues = httpContext.Response.Headers.Keys.Select(key => key + ": " + string.Join(",", httpContext.Response.Headers[key].ToArray()));
Expand All @@ -240,7 +241,7 @@ private async Task ExtractResponseProperties(HttpContext httpContext)
// This is for middleware hooked before us to see our changes.
// Otherwise the original stream would be seen which cannot be read again.
// The middleware that sends the response to the client is affected as well.
await responseBody.CopyToAsync(originalBodyStream);
await responseBody.CopyToAsync(originalBodyStream, CancellationToken.None);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Threading.Tasks;
using System.Threading.Tasks;
using Xunit;

#nullable enable
Expand All @@ -10,7 +10,7 @@ public class AATestPlaywrightInstallation : BaseTest, IClassFixture<TestFixture>
[Fact]
public async Task ShouldDisplayGoogleHomePage()
{
await Task.Delay(10000); // NOTE - This test sometimes just fails in build pipeline with error about google hanging up the connection, maybe just need to give the network a little extra time to get ready?
await Task.Delay(10000, TestContext.Current.CancellationToken); // NOTE - This test sometimes just fails in build pipeline with error about google hanging up the connection, maybe just need to give the network a little extra time to get ready?

await TestAsync($"{nameof(AATestPlaywrightInstallation)} - {nameof(ShouldDisplayGoogleHomePage)}", async (page) =>
{
Expand All @@ -24,4 +24,4 @@ await TestAsync($"{nameof(AATestPlaywrightInstallation)} - {nameof(ShouldDisplay
});
}
}
}
}
3 changes: 2 additions & 1 deletion Source/CDR.DataRecipient.E2ETests/BaseTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System.Threading;
using System.Threading.Tasks;
using CDR.DataRecipient.E2ETests.Pages;
using CDR.DataRecipient.E2ETests.XUnit.Orderers;
using FluentAssertions;
using FluentAssertions.Execution;
using Microsoft.Data.SqlClient;
Expand All @@ -26,7 +27,7 @@ namespace CDR.DataRecipient.E2ETests
{
// Put all tests in same collection because we need them to run sequentially since some tests are mutating DB.
[Collection("E2ETests")]
[TestCaseOrderer("CDR.DataRecipient.E2ETests.XUnit.Orderers.AlphabeticalOrderer", "CDR.DataRecipient.E2ETests")]
[TestMethodOrderer(typeof(AlphabeticalOrderer))]
[DisplayTestMethodName]
public class BaseTest
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<IsPackable>false</IsPackable>
<OutputType>Exe</OutputType>
<TargetFramework>$(TargetFrameworkVersion)</TargetFramework>
<Version>$(Version)</Version>
<FileVersion>$(Version)</FileVersion>
<AssemblyVersion>$(Version)</AssemblyVersion>
</PropertyGroup>
<ItemGroup>
<None Remove="appsettings.Development.json" />
</ItemGroup>
<ItemGroup>
<Content Include="appsettings.Development.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="appsettings.Release.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Azure.Identity" />
<PackageReference Include="FluentAssertions" />
<PackageReference Include="Microsoft.Data.SqlClient" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Microsoft.Playwright" />
<PackageReference Include="xunit" />
<PackageReference Include="Microsoft.Testing.Extensions.TrxReport" />
<PackageReference Include="xunit.v3" />
<PackageReference Include="xunit.runner.visualstudio">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand All @@ -41,6 +29,12 @@
<ProjectReference Include="..\CDR.DataRecipient.IntegrationTests\CDR.DataRecipient.IntegrationTests.csproj" />
</ItemGroup>
<ItemGroup>
<None Include="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="appsettings.*.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Certificates\client.pfx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System;
using System.Reflection;
using Xunit.Sdk;
using Xunit.v3;

#nullable enable

Expand All @@ -10,13 +11,13 @@ class DisplayTestMethodNameAttribute : BeforeAfterTestAttribute
{
static int count = 0;

public override void Before(MethodInfo methodUnderTest)
public override void Before(MethodInfo methodUnderTest, IXunitTest test)
{
Console.WriteLine($"Test #{++count} - {methodUnderTest.DeclaringType?.Name}.{methodUnderTest.Name}");
}

public override void After(MethodInfo methodUnderTest)
public override void After(MethodInfo methodUnderTest, IXunitTest test)
{
}
}
}
}
12 changes: 6 additions & 6 deletions Source/CDR.DataRecipient.E2ETests/Fixtures/TestFixture.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Threading.Tasks;
using System.Threading.Tasks;
using Xunit;

#nullable enable
Expand All @@ -10,7 +10,7 @@ public class TestFixture : IAsyncLifetime
private static readonly string[] installArguments = ["install"];
private static readonly string[] installDepsArguments = ["install-deeps"];

public Task InitializeAsync()
public ValueTask InitializeAsync()
{
// Only install Playwright if not running in container, since Dockerfile.e2e-tests already installed Playwright
if (!BaseTest.RUNNING_IN_CONTAINER)
Expand All @@ -20,12 +20,12 @@ public Task InitializeAsync()
Microsoft.Playwright.Program.Main(installDepsArguments);
}

return Task.CompletedTask;
return ValueTask.CompletedTask;
}

public Task DisposeAsync()
public ValueTask DisposeAsync()
{
return Task.CompletedTask;
return ValueTask.CompletedTask;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
Expand Down Expand Up @@ -109,7 +109,7 @@ static string BuildContent(string scope, string grant_type, string client_id, st
// Attach client certificate to handler
if (CertificateFilename != null)
{
var clientCertificate = new X509Certificate2(CertificateFilename, CertificatePassword, X509KeyStorageFlags.Exportable);
var clientCertificate = X509CertificateLoader.LoadPkcs12FromFile(CertificateFilename, CertificatePassword, X509KeyStorageFlags.Exportable);
_clientHandler.ClientCertificates.Add(clientCertificate);
}

Expand Down
Loading
Loading