ITADN
hmcts/ccd-api-gateway
README.md

ccd-api-gateway

License: MIT Greenkeeper badge Build Status Docker Build Status codecov Codacy Badge Known Vulnerabilities HitCount Issue Stats

Secured API Gateway integrating with IDAM

Getting started

git clone https://github.com/hmcts/ccd-api-gateway.git
cd ccd-api-gateway

Prerequisites

Environment variables

The following environment variables are required:

NameDescription
PROXY_AGGREGATEDBase URL of the aggregated API. http://localhost:4452 for the dockerised local instance.
PROXY_DATABase URL of the Data Store API. http://localhost:4452 for the dockerised local instance.
PROXY_DEFINITION_IMPORTBase URL of the Definition Store API. http://localhost:4451 for the dockerised local instance.
PROXY_DEFINITION_DATABase URL of the Definition Store API. http://localhost:4451 for the dockerised local instance.
PROXY_DEFINITION_DISPLAYBase URL of the Definition Store API. http://localhost:4451 for the dockerised local instance.
PROXY_DOCUMENT_MANAGEMENTBase URL of the remote Document Management API gateway.
PROXY_PRINT_SERVICEBase URL of the CCD Case Data Print Service. http://localhost:3100 for the dockerised local instance.
PROXY_CASE_ACTIVITYBase URL of the CCD Case Activity API. http://localhost:3460 for the non-dockerised local instance.
IDAM_USER_URLBase URL for IdAM's User API service (idam-app). http://localhost:4501 for the dockerised local instance or tunnelled dev instance.
IDAM_S2S_URLBase URL for IdAM's S2S API service (service-auth-provider). http://localhost:4502 for the dockerised local instance or tunnelled dev instance.
IDAM_SERVICE_KEYAPI Gateway's IDAM S2S micro-service secret key. This must match the IDAM instance it's being run against.
IDAM_OAUTH2_LOGOUT_ENDPOINTURL of the IdAM OAuth2 API logout endpoint. http://localhost:4501/session/:token for the dockerised local instance.
IDAM_OAUTH2_TOKEN_ENDPOINTURL of the IdAM OAuth2 API endpoint for obtaining an OAuth2 token. http://localhost:4501/oauth2/token for the dockerised local instance or tunnelled dev instance.
IDAM_OAUTH2_CLIENT_SECRETSecret to be passed to IdAM when obtaining an OAuth2 token. This must match the IdAM instance it's being run against.
ADDRESS_LOOKUP_TOKENToken for use with the MoJ Address Lookup service.
CORS_ORIGIN_WHITELISTComma-separated list of authorised origins for Cross-Origin requests. http://localhost:3451,http://localhost:3452 for the local instances of CCD
APPINSIGHTS_INSTRUMENTATIONKEYSecret for Microsoft Insights logging, can be a dummy string in local.

Note: To support large document uploads via the api gateway, the maximum allowed length for request content is configured via maxAllowedContentLength property for request filter in web.config (config file within source repository).

Install dependencies

The project uses yarn.

To install dependencies please execute the following command:

yarn install

Running

Simply run:

yarn start

to start the API gateway on http://localhost:3453.

Docker

If you want your code to become available to other Docker projects (e.g. for local environment testing), you need to build the image:

docker-compose build

You can run it by executing following command:

docker-compose up

As a result, the API gateway will be started and made available on port 3453.

Integration tests

The integration tests are mavenized and can be run using:

yarn integration