Microservice for authenticating users of members.tko-aly.fi.
Documentation generated by Typedoc here
- Clone the repo
(Optional: Run nvm install and nvm use to install the correct Node version. This requires Node Version Manager (NVM) to be installed)
- Run
yarn install - Copy
.env.exampleto.envand set environment variables - Run
yarn testto run unit & API tests. Runyarn browser-testto run E2E tests. - Run
yarn startor `yarn watch``
The Dockerfile uses npm (and our very specific package-lock.json configuration).
Make sure to run npm install before pushing, if you have new dependencies.
- Clone the repo
- Copy
.env.deploy.exampleto.env.deployand set your Docker credentials - Run
chmod +x ./deploy-container.shand after that, run./deploy-container.sh
This will build the image and push it to registry.tko-aly.fi Docker registry.
docker-compose up -d. Now you can check adminer http://localhost:8081 (uname: root, pw: unsecure). The service is running at http://localhost:8080.docker-compose run web yarn migrate.docker-compose run web yarn seed.- Boom, you should be ready to tyckittää.
Shows the user a login form, that authenticates to a service identified by the service identifier. If the user is already authenticated to the service, the form will redirect the user to the service specified.
If the user does not input a service identifier, the following view is shown:
If the login fails, the following view is shown:
After clicking login, the user is redirected to the permission prompt page:
Authenticates a user with username, password and a service identifier. It returns a authorization token which can be used to fetch user information.
Example of form POST body:
{
"username": "hugeli",
"password": "1234",
"serviceIdentifier": "12a0058d-f9aa-1e22-b01a-6025700dab1f"
}The response of this request is a form verifying what user information is used in that service (services are identified by an unique service idenfitier.)
The dataRequest query parameter is required. It is a bitfield which values are 2 ^ the User model's attribute index.
If I wan't to get the id, name and email of a user, I do Math.pow(2, 0) | Math.pow(2, 2) | Math.pow(2, 4), then insert that value into the dataRequest query. It would return:
Example response:
{
"ok": true,
"message": "Success",
"payload": {
"id": 420,
"name": "Bob John",
"email": "asd@asd.com"
}
}


