Code Monkey home page Code Monkey logo

mock-data-holder-energy's Introduction

Consumer Data Right Logo

maintenance-status Consumer Data Standards v1.22.1 Conformance Test Suite 4.0 FAPI 1.0 Advanced Profile made-with-dotnet made-with-csharp MIT License

Project Deprecated

This project is deprecated and is no longer actively maintained. Refer to the Mock Data Holder repository which contains an implementation of a Mock Data Holder for the Energy sector.

Consumer Data Right - Mock Data Holder Energy

This project includes source code, documentation and instructions for a Consumer Data Right (CDR) Mock Data Holder Energy.

This repository contains a mock implementation of a Data Holder in the Energy sector and is offered to help the community in the development and testing of their CDR solutions.

Mock Data Holder Energy - Alignment

The Mock Data Holder Energy:

Note: Consumer Data Standards FAPI 1.0 Migration Phase 1 is no longer supported.

Getting Started

The Mock Data Holder Energy uses the the Authorisation Server, Mock Register and the Mock Data Recipient. You can swap out any of the Mock Data Holder Energy, Mock 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:

  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-data-holder-energy.git

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

Note: Starting from version 1.2.0, the Mock Data Holder Energy now utilises the Authorisation Server as an Identity Provider. The Authorisation Server also needs to be running when running the Mock Data Holder Energy. The Authorisation Server repository can be cloned using following command.

git clone https://github.com/ConsumerDataRight/authorisation-server.git ./cdr-auth-server

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

Use the pre-built image

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

Note: Starting from version 1.2.0, the Identity Server has been replaced with the Authorisation Server. Although the Authorisation Server exists as a separate repository, when the mock-data-holder energy image is built for Docker, the Authorization Server is copied into the image, replacing Identity Server 4.

Pull the latest image

docker pull consumerdataright/mock-data-holder-energy

To get help on launching and debugging the solutions as containers and switching out your solution(s), see the help guide.

Try it out

Once the Mock Data Holder Energy container is running, you can use the provided Mock Data Holder Energy 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 Data Holder Energy.

Loading your own data

When the Mock Data Holder Energy 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 Energy 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:

  1. Provide your own seed-data.json file within the Mock Data Holder Energy container
  • Within the /app/manage/Data folder of the container, make a copy of the seed-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.
  1. Use the Manage API endpoint to load data

The Mock Data Holder Energy 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:8105/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:8105/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.

Use the docker compose file to run a multi-container mock CDR Ecosystem

The docker compose file can be used to run multiple containers from the Mock CDR Ecosystem.

Note: the docker compose file utilises the Microsoft SQL Server Image from Docker Hub. The Microsoft EULA for the Microsoft SQL Server Image must be accepted to use the docker compose file. See the Microsoft SQL Server Image on Docker Hub for more information.

To get help on launching and debugging the solutions as containers and switching out your solution(s), see the help guide.

Mock Data Holder Energy - Architecture

The following diagram outlines the high level architecture of the Mock Data Holder Energy:

Mock Data Holder Energy - Architecture

Mock Data Holder Energy - Components

The Mock Data Holder Energy contains the following components:

  • Public API
    • Hosted at https://localhost:8100
    • Contains the public discovery APIs - Get Status and Get Outages.
    • Accessed directly on port 8100.
  • Identity Provider
    • Hosted at https://localhost:8101
    • Mock Data Holder Energy Identity Provider implementation utilising the Authorisation Server hosted as separate repository.
    • Accessed directly (TLS only) as well as the mTLS Gateway, depending on the target endpoint.
  • mTLS Gateway
    • Hosted at https://localhost:8102
    • Provides the base URL endpoint for mTLS communications, including Infosec, Resource and Admin APIs.
    • Performs certificate validation.
  • Resource API
    • Hosted at https://localhost:8103
    • Currently includes the Get Customer, Get Accounts and Get Concessions endpoints.
    • Accessed via the mTLS Gateway.
  • Manage API
    • Hosted at https://localhost:8105
    • Not part of the Consumer Data Standards, but allows for the maintenance of data in the Mock Data Holder Energy 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.
  • Repository
    • A SQL database containing Mock Data Holder Energy data.

Technology Stack

The following technologies have been used to build the Mock Data Holder Energy:

  • The source code has been written in C# using the .Net 6 framework.
  • The Identity Provider is implemented using the Authorisation Server.
  • The mTLS Gateway has 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 Data Holder Energy and view the expected interactions. See the Mock Data Holder Energy Postman documentation for more information.

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 Data Holder Energy is provided as a development tool only. It conforms to the Consumer Data Standards.

mock-data-holder-energy's People

Contributors

cdr-amirm avatar cdr-andrewg avatar cdr-ct avatar cdr-davidr avatar cdr-df avatar cdr-farooqk avatar cdr-lukeh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mock-data-holder-energy's Issues

No "response_modes_supported" in odic discovery response but mock data holder supports "fragment" only

Describe the bug
By standard, it seems when "response_modes_supported" is omitted, the provider should support both ["query", "fragment"]

To Reproduce
Steps to reproduce the behavior:

  1. pass response_mode=query in authorization request
  2. get bad request result from the mock data holder

Expected behaviour
Either oidc discovery response specifies that the provider supports fragment only or the recipient should be able to use query as response mode.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.