This project includes source code, documentation and instructions for a Consumer Data Right (CDR) Mock Data Holder.
This repository contains a mock implementation of a Mock Data Holder and is offered to help the community in the development and testing of their CDR solutions.
The Mock Data Holder aligns to v1.11.1 of the Consumer Data Standards. The Mock Data Holder passed v3.2 of the Conformance Test Suite for Data Holders. The Mock Data Holder was tested against FAPI 0.6 using the consumerdataright_au profile.
The Mock Data Holder was built using the Mock Register and the Mock Data Recipient. You can swap out any of the Mock Data Holder, Mock Data Register and Mock Data Recipient solutions with a solution of your own.
There are a number of ways that the artefacts within this project can be used:
- Build and deploy the source code
- Use the pre-built image
- Use the docker compose file to run a multi-container mock CDR Ecosystem
To get started, clone the source code.
git clone https://github.com/ConsumerDataRight/mock-data-holder.git
Use the Start-DataHolder.bat file to build and start all of theprojects needed to run the Data Holder. Conversely, update the start up projects for the solution to match the Start-DataHolder.bat file.
If you would like to contribute features or fixes back to the Mock Data Holder repository, consult the contributing guidelines.
A version of the Mock Data Holder is built into a single Docker image that is made available via docker hub.
The container can simply be run by pulling and running the latest image using the following Docker commands:
docker pull consumerdataright/mock-data-holder
docker run -d -h mock-data-holder -p 8000:8000 -p 8001:8001 -p 8002:8002 -p 8005:8005 --name mock-data-holder consumerdataright/mock-data-holder
Once the Mock Data Holder container is running, you can use the provided Mock Data Holder Postman API collection to try it out.
Consult the Certificate Management documentation for more information about how certificates are used for the Mock Data Holder.
When the Mock Data Holder container first starts it will load data from the included seed-data.json
file that is included in the CDR.DataHolder.Manage.API
project. This file includes dummy banking data (customers, accounts, transactions) as well as data recipient metadata that can be obtained from the Register. When calls are made to the Resource API the dummy banking data is returned. The data recipient metadata is used within the internal workings of the Mock Data Holder to check their status before responding to data sharing requests.
There are a couple of ways to load your own data into the container instance:
- Provide your own
seed-data.json
file within the Mock Data Holder container
- Within the
/app/manage/Data
folder of the container, make a copy of theseed-data.json
file, renaming to a name of your choice, e.g.my-seed-data.json
. - Update your seed data file with your desired metadata.
- Change the
/app/manage/appsettings.json
file to load the new data file and overwrite the existing data:
"SeedData": {
"FilePath": "Data/my-seed-data.json",
"OverwriteExistingData": true
},
- Restart the container.
- Use the Manage API endpoint to load data
The Mock Data Holder includes a Manage API that allows metadata to be downloaded and uploaded from the repository.
To retrieve the current metadata held within the repository make the following request to the Manage API:
GET https://localhost:8005/manage/metadata
The response will be metadata in JSON format that conforms to the same structure of the seed-data.json
file. This payload structure is also the same structure that is used to load new metadata via the Manage API.
To re-load the repository with metadata make the following request to the Manage API:
Note: calling this API will delete all existing metadata and re-load with the provided metadata
POST https://localhost:8005/manage/metadata
{
<JSON metadata - as per the GET /manage/metadata response or seed-data.json file>
}
Note: there is currently no authentication/authorisation applied to the Manage API endpoints as these are seen to be under the control of the container owner. This can be added if there is community feedback to that effect or if a pull request is submitted.
The docker compose file can be used to run multiple containers from the Mock CDR Ecosystem.
- Add the following to your hosts file, eg C:\Windows\System32\drivers\etc\hosts
127.0.0.1 mock-data-holder
127.0.0.1 mock-data-recipient
127.0.0.1 mock-register
- Flush the DNS cache, on Windows use:
ipconfig /flushdns
- Run the docker compose file
docker-compose up
Update the docker compose file if you would like to swap out one of the mock solutions with a solution of your own.
The following diagram outlines the high level architecture of the Mock Data Holder:
The Mock Data Holder contains the following components:
- Public API
- Hosted at
https://localhost:8000
- Contains the public discovery APIs -
Get Status
andGet Outages
. - Accessed directly on
port 8000
.
- Hosted at
- Identity Provider
- Hosted at
https://localhost:8001
- Mock Data Holder identity provider implementation utilising
Identity Server 4
- Accessed directly (TLS only) as well as the mTLS Gateway, depending on the target endpoint.
- Hosted at
- mTLS Gateway
- Hosted at
https://localhost:8002
- Provides the base URL endpoint for mTLS communications, including Infosec, Resource and Admin APIs.
- Performs certificate validation.
- Hosted at
- Resource API
- Hosted at
https://localhost:8003
- Currently includes the
Get Customer
,Get Accounts
andGet Transactions
endpoints. - Accessed via the mTLS Gateway.
- Hosted at
- Manage API
- Hosted at
https://localhost:8005
- Not part of the Consumer Data Standards, but allows for the maintenance of data in the Mock Data Holder repository.
- Also includes trigger points to refresh the Data Recipient, Data Recipient Status and Software Product Status from the Mock Register.
- A user interface may be added at some time in the future to provide user friendly access to the repository data.
- Hosted at
- Repository
- A SQLite database containing Mock Data Holder data.
The following technologies have been used to build the Mock Data Holder:
- The source code has been written in
C#
using the.NET 5
framework. - The Identity Provider is implemented using
Identity Server 4
. - The mTLS Gateway has been implemented using
Ocelot
. - The Repository utilises a
SQLite
instance.
A collection of API requests has been made available in Postman in order to test the Mock Data Holder and view the expected interactions. See the Mock Data Holder Postman documentation for more information.
We encourage contributions from the community. See our contributing guidelines.
This project has adopted the Contributor Covenant. For more information see the code of conduct.
The Mock Data Holder is provided as a development tool only. It conforms to the Consumer Data Standards and Register Design.