0.1.0 • Published 2 years ago

angliru-authentication-service v0.1.0

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

Angliru Authentication Service

error documentation

functionality

register a user

see wiki for payload description

Adding a function

To add a function, add a new express endpoint in src/index and a new file in the controllers folder.

Endpoints

/health Ensure the api is up and running and will return 200 on success

/authorise Expects the data to contain Igi interface and a custom token is generated with the claims defined in the IFirebaseDeveloperClaims interface. Returns token and claims

/user disables the user in Firebase and leverages the send_email topic queue for sending deletion emails to legal.

Testing & running locally

Run the express application locally with npm run dev. The app will be available at http://localhost:8080

Add the following config to .vscode/launch.json debugger for added superpowers

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "attach",
      "name": "Attach",
      "port": 9229
    }
  ]
}

Deploying

The circle ci repo settings must have an environmental variable SERVICE_ACCOUNT_CLOUD_RUN that is a base64-encrypted string of the google service account json auth key. Also the npm_libs context in circle ci contains the organisation PAT token required for our private repositories

Docker image is built within circle ci and then pushed to GCR. Cloud run uses the latest image pushed to GCR.

We also use private repos by injecting .npmrc with environment variables from circle ci on the building of the docker image, this is removed during the build process before pushing the image.

Currently this is deployed to angliru-staging and angliru-production.

Connection strings to databases should be set in circleci
`USER_PROFILE_URI_STAGING`
`USER_PROFILE_URI_PRODUCTION`