Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

feedhenry-templates/saml-cloud-app

Repository files navigation

FeedHenry SAML Cloud App

Dependency Status

This is an example SAML Cloud App, designed to be used in conjunction with our sample SAML Service. The Cloud App here only proxies calls from client to an SAML Service (e.g. fetching a URL to display in the WebView for IdP login). You must set a SAML_SERVICE environment variable with an appropriate SAML Service ID for this to work.

Group API

host [/sso/session/login_host]

Get URL for SSO Sign-in

host [POST]

'host' endpoint.

  • Request (application/json)

    • Body { "token": "deviceId" }
  • Response 200 (application/json)

    • Body { }

session [/sso/session/valid]

Session check endpoint

session [POST]

'session world' endpoint.

  • Request (application/json)

    • Body { "token": "deviceId" }
  • Response 200 (application/json)

    • Body { }

Build

npm install

Run locally

Setup MongoDB

In order to run the SAML server locally you'll need to have MongoDB installed and running on your local machine.

Start MongoDB server with:

mongod

By default, the SAML server will try to access MongoDB on port 27017, if you are running MongoDB on a different port you should set the FH_MONGODB_CONN_URL environment variable to the MongoDB connection URL.

Setup Redis

In order to run the SAML server locally you'll need to have Redis installed and running on your local machine.

Start Redis server with:

redis-server /usr/local/etc/redis.conf

Start the server

npm run serve

The SAML server will be availble at localhost:8001.

If you wish to run the server on a different port you should set the FH_PORT environment variable to the port you want the server to run on.

Development

See Cloud Development page about how to develop cloud app.

Tests

All the tests are in the "test/" directory. The cloud app is using mocha as the test runner.

Unit and acceptance tests

  • all the tests:

With MongoDB and Redis running

npm test
  • unit tests:
npm run unit
  • acceptance tests:

With MongoDB and Redis running

npm run accept

Code coverage

npm run coverage
  • coverage report for unit tests:
npm run coverage-unit
  • coverage report for acceptance tests:
npm run coverage-accept

Source code analysis

To get Plato's JavaScript source code visualization, static analysis, and complexity report:

npm run analysis