Skip to content

Latest commit

 

History

History
112 lines (76 loc) · 3.21 KB

SETUP.md

File metadata and controls

112 lines (76 loc) · 3.21 KB

Quick setup

To run this project you need to have Node and NPM installed.

npm install
npm start

Then surf to localhost:1337 in your browser to run the site.

--everything below is optional--

You see all available api calls on localhost:1337/api (when config.showApiDocs is enabled)

Run configurations

environments

select an environment with this command export NODE_ENV="development"

  • development
    • authentication routes disabled
    • dummy data
  • dev_auth
    • authentication routes enabled
    • dummy data
  • auth
    • authentication routes enabled
    • data from config.endpoints

these environments are defined in server config

Authentication

This app requires 3 files to be placed in the folder server/cert. These files include (1) the certificate of the Identity Provider (IdP). As a Service Provider (SP), you need to generate your own (2) certificate and (3) private key. These files are named as follows:

  • idp_cert.pem: Identity Provider's public key
  • key.pem: Service Provider private key (generated by you)
  • cert.pem: Service Provider public key (generated by you)

Creating Private Key and Certificates

Generate key.pem and cert.pem by the following command:

# create folder which will contain certificates
mkdir server/cert

# generate private and public key
openssl req -x509 -newkey rsa:4096 -keyout server/cert/key.pem -out server/cert/cert.pem -nodes -days 900

Your Identity Provider will need to:

  • give you it's public key (store it in server/cert/idp_cert.pem)
  • add your site's public key(cert.pem) to it's server

If your site is available online, your Identity Provider can get it directly by surfing to http://<your-site>/Metadata

Run locally

Add 127.0.0.1 mijn-qas.viaa.be to the hosts file on your computer. This is needed to intercept the data from the authentication servers.

you can replace mijn-qas.viaa.be by the host part you have in config.passport.saml.callbackUrl

# install dependencies
npm install

# you need to run as admin to be able to use port 80
sudo bash

# set environment
export NODE_ENV="qas"

# 80 is default port for http
export PORT=80

# run the server
npm start

Why all this complicated stuff?

To be able to intercept the SAML response from the authentication servers we need to:

  • add url to hosts file
  • listen on port 80

Configuration files

eg. port to listen on, mock data, show api documentation page, enable authentication, ...

eg. add, remove, change graph type, change API calls, ...

eg. add, remove, change content

Utilities for development

grunt watch

Automatically rebuild public folder when changes are made.

  • run: grunt watch

nodemon

Automatically restart the server every time changes are made.

  • install: npm install -g nodemon

  • run: nodemon ./server/server.js