This document is intended for developers who are interested in learning how to modify and test the Helix Authentication Service.
To fetch and build the application dependencies and run tests, you will need Node.js LTS or higher.
Configure the authentication service as described in the documentation, then build and start the authentication service:
$ npm install
$ npm start
Refer to the README.md
file in the containers
directory for instructions.
The containers for the extension for integrating the authentication service with
Helix Core are in a separate
repository and can
be installed using docker compose
as described in the documentation for that
project.
Some automated tests are provided for ensuring basic operational soundness (e.g.
user can authenticate via IdP, application can retrieve user profile data). The
login tests utilize the Selenium webdriver to start
Firefox in headless mode. As such, a recent release of
Firefox must be installed on the test
system. Additionally, the Docker containers defined in
docker-compose.yml
must be built and running.
$ docker compose build auth-svc1.doc
$ docker compose up --build -d
$ npm test
Many of the unit tests do not use the .doc
Docker containers and thus most of
the test suite can be run using this command:
$ npm unit
To run a single test, use npx mocha
as shown in the example below:
$ npx mocha --exit test/features/login/domain/usecases/GetSamlAuthnContext.test.js
If the test makes use of setTimeout()
then add the --delay
flag:
$ npx mocha --exit --delay test/features/login/presentation/routes/requests.test.js
If for some reason you do not want the auth service to be using HTTPS and its default self-signed certificate, you can use HTTP instead. This is particularly relevant when developing with a browser that refuses to open insecure web sites, such as the SAML Desktop Agent with its embedded Chromium browser.
To switch from http:
to https:
you will need to change at least three settings:
- Set
SVC_BASE_URI
appropriately in the auth service configuration. - Set service URL in the client system (e.g. Perforce server).
- Set the callback URL in the identity provider.
With respect to the JavaScript code, the formatting follows StandardJS. The linter available in Atom is very good, and catches many common coding mistakes. Likewise with Visual Studio Code and the StandardJS extension.
The sequence_diagram.mmd
uses mermaid syntax,
which the mermaid.cli tool reads to
produce the diagram of the authentication workflow.
To generate the diagram, invoke mmdc
like so:
$ npm install -g mermaid.cli
$ mmdc -i docs/sequence_diagram.mmd -t neutral -o flow.png