Skip to content

A mock version of the Consumer Data Right Register that can be used in the development and testing of CDR solutions.

License

Notifications You must be signed in to change notification settings

cloudentity/mock-register

 
 

Repository files navigation

Consumer Data Right Logo

Consumer Data Standards v1.18.0 made-with-dotnet made-with-csharp MIT License Pull Requests Welcome

Consumer Data Right - Mock Register

This project includes source code, documentation and instructions for the Consumer Data Right (CDR) Mock Register.

The ACCC operates the CDR Register within the CDR ecosystem. This repository contains a mock implementation of the Mock Register and is offered to help the community in the development and testing of their CDR solutions.

Mock Register - Alignment

The Mock Register aligns to v1.18.0 of the Consumer Data Standards.

Getting Started

There are a number of ways that the artefacts within this project can be used:

  1. Build and deploy the source code
  2. Use the pre-built image
  3. Use the docker compose file to run a multi-container mock CDR Ecosystem

Build and deploy the source code

To get started, clone the source code.

git clone https://github.com/ConsumerDataRight/mock-register.git

To get help on launching and debugging the solution, see the help guide.

If you would like to contribute features or fixes back to the Mock Register repository, consult the contributing guidelines.

Use the pre-built image

A version of the Mock Register is built into a single Docker image that is made available via docker hub.

Pull the latest image

docker pull consumerdataright/mock-register

To get help on running the Mock Register container, see the help guide.

Use the docker-compose.Ecosystem.yml file to run a multi-container Mock CDR Ecosystem

The docker-compose.Ecosystem.yml file can be used to run multiple containers to create a Mock CDR Ecosystem.

To get help on launching the Mock CDR Ecosystem, see the help guide. The help guide also contains instructions for swapping out one of the mock solutions running in the multi-container Mock CDR Ecosystem with a mock solution running in MS Visual Studio or with your own solution.

Try it out

Once the Mock Register is running, you can use the provided Mock Register Postman API collection to try it out.

Certificate Management

Consult the Certificate Management documentation for more information about how certificates are used for the Mock Register.

Loading your own data

When the Mock Register first starts it will load data from the included seed-data.json file that is included in the CDR.Register.Admin.API project. This file includes dummy metadata for data holders and data recipients. When calls are made to the Mock Register endpoints the dummy metadata is returned.

There are a couple of ways to load your own data into the Mock Register:

  1. Provide your own seed-data.json file within the Mock Register

    • Mock Register container:

      • Within the /app/admin/Data folder of the container, make a copy of the seed-data.Release.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/admin/appsettings.Release.json file to load the new data file and overwrite the existing data:
      "SeedData": {
          "FilePath": "Data/my-seed-data.json",
          "OverwriteExistingData": true
      },
      
      • Restart the Mock Register container.
    • Mock Register source:

      • Within the .\Source\CDR.Register.Admin.API\Data folder, make a copy of the seed-data.Development.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 .\Source\appsettings.Development.json file to load the new data file and overwrite the existing data:
      "SeedData": {
          "FilePath": "Data/my-seed-data.json",
          "OverwriteExistingData": true
      },
      
      • Build and run the Mock Register.
  2. Use the Admin API endpoint to load data

The Mock Register includes an Admin 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 Admin API:

GET https://localhost:7006/admin/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 Admin API.

To re-load the repository with metadata make the following request to the Admin API:

Note: calling this API will delete all existing metadata and re-load with the provided metadata

POST https://localhost:7006/admin/metadata

{
    <JSON metadata - as per the GET /admin/metadata response or seed-data.json file>
}

Note: there is currently no authentication/authorisation applied to the Admin 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.

Mock Register - Architecture

The following diagram outlines the high level architecture of the Mock Register:

Mock Register - Architecture

Mock Register - Components

The Mock Register contains the following components:

  • TLS Gateway
    • Hosted at https://localhost:7000
    • Provides the base URL endpoint for TLS only Register communications
  • mTLS Gateway
    • Hosted at https://localhost:7001
    • Provides the base URL endpoint for mTLS Register communications
    • Performs certificate validation
  • Identity Provider
    • Hosted at https://localhost:7002
    • Register identity provider implementation utilising .Net 6
    • Accessed via the TLS and mTLS Gateways, depending on the target endpoint.
  • Discovery API
    • Hosted at https://localhost:7003
    • Contains the GetDataHolderBrands and GetDataRecipients Register APIs.
    • Accessed via the TLS Gateway (GetDataRecipients) and mTLS gateway (GetDataHolderBrands).
  • Status API
    • Hosted at https://localhost:7004
    • Contains the GetDataRecipientsStatus, GetSoftwareProductsStatus and GetDataHoldersStatus Register APIs.
    • Accessed via the TLS Gateway.
  • SSA API
    • Hosted at https://localhost:7005
    • Contains the SSA JWKS and GetSoftwareStatementAssertion Register APIs.
    • Accessed via the TLS (SSA JWKS) and mTLS Gateway (GetSoftwareStatementAssertion).
  • Admin API
    • Hosted at https://localhost:7006
    • Not part of the Register standard, but allows for the maintenance of metadata in the Mock Register repository.
    • A user interface may be added at some time in the future to provide user friendly access to the repository data.
    • Contains loopback dummy Data Recipient endpoints used for testing purposes.
  • Repository
    • A SQL database containing Register metadata.

Technology Stack

The following technologies have been used to build the Mock Register:

  • The source code has been written in C# using the .Net 6 framework.
  • The Identity Provider is implemented using .Net 6.
  • The TLS and mTLS Gateways have been implemented using Ocelot.
  • The Repository utilises a SQL instance.

Testing

A collection of API requests has been made available in Postman in order to test the Mock Register and view the expected interactions. See the Mock Register Postman documentation for more information.

Frequently Asked Questions

See the Frequently Asked Questions page for answers to some common questions and links to help files.

Contribute

We encourage contributions from the community. See our contributing guidelines.

Code of Conduct

This project has adopted the Contributor Covenant. For more information see the code of conduct.

License

MIT License

Notes

The Mock Register is provided as a development tool and is not an exact replica of the production CDR Register.
It conforms to the Consumer Data Standards, however there may be slight differences due to infrastructure and technology stack variances with the production CDR Register.

About

A mock version of the Consumer Data Right Register that can be used in the development and testing of CDR solutions.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 98.1%
  • Other 1.9%