orchestracities / auth-management-ui

An UI for Anubis and FIWARE-based platforms
https://master--62bcedd6cc1b1300eb9e1607.chromatic.com/
Apache License 2.0
0 stars 1 forks source link

Auth Management UI

FIWARE Security License: APACHE-2.0 Docker Status Support

Storybook

This web application is an UI for Anubis using Material for you (or Material v3) design system and MUI in order to provide an intuitive and a familiar look and feel for the end user.

Interface

Architecture

Currently, the Auth Management UI interacts with and ODIC provider (Keycloak in the demo) to authenticate users, Anubis to manage authorization policies, a Configuration API based on Apollo GraphQL to store user preferences.

                       ┌─────────────┐
                       │    OIDC     │
                       │             │
                       │   Provider  │
                       └─────────────┘
                              ▲
                            2 │
                              │
┌─────────────┐        ┌──────┴──────┐        ┌─────────────┐
│             │   1    │Authorization│   3    │Configuration│
│   Browser   ├───────►│  Management ├───────►│             │
│             │        │     UI      │        │     API     │
└─────────────┘        └──────┬──────┘        └─────────────┘
                              │
                            4 │
                              ▼
                       ┌─────────────┐
                       │Authorization│
                       │  Management │
                       │     API     │
                       └─────────────┘

(The schema is editable at asciiflow)

Demo

Requirements

To run this demo you'll need to have the following installed:

Deployment

To run the demo in your local environment, you need to create a .env (an example file is provided .env.docker).

To be able to create tenants, the hostname of the token issuer (Keycloak) in docker and in your local system, needs to be the same, to ensure that, add the following entry in your /etc/hosts:

127.0.0.1       keycloak

To deploy the demo that includes the Auth UI, Anubis, the Configuration API and Keycloak, run the following script:

$ start.sh

The default user/password are admin@mail.com/admin for the app. root/example for mongo (a change needs a new config for start.sh and fiware).

Installation

The Auth Management UI is available as a docker container.

The Auth Management UI depends on:

An example docker compose is provided in this repository that deploy all the dependencies. A complete deployment including policy enforcement needs additional dependencies as documented in Anubis repository.

Environment Variables

The following environment variables are used to configure the Management UI and the Configuration API:

Development set-up

To run the UI and the Configuration API in your local environment, you need to create a .env (an example file is provided .env.development).

To start the dependencies:

$ sh start.sh dev

In case you add new environment variables, don't forget to re-generate the src/env.js file:

$ npx generate-env-getter js

NOTE: Tenant creation won't work due to the issuer different between docker (keycloak) and your local environment (localhost), you can solve this by adding and entry in your /etc/hosts file that points 127.0.0.1 to keycloak and using using keycloak as hostname in REACT_APP_KEYCLOACK_ADMIN and REACT_APP_OIDC_ISSUER. This is already the default value in case of .env.docker.

Management UI

To start the locally the Management UI:

$ npm install
$ npm start

Configuration API

To install and launch locally the Configuration API (in a different shell from the one where you launched the Management UI):

$ cd configuration-api
$ npm install
$ cp ../.env .
$ node main/mongo/populateDB.js
$ node main/advancedAuth.js

Generate documentation

To generate the documentation is mandatory to set up the Management UI first, once completed:

$ cd documentation 
$ npm install
$ npm run storybook

How to test the UI with Cypress

To test UI with Cypress the UI and API should be up and running, once completed:

$ npm install
$ npm run cypress:test

If you want to open cypress studio to run tests in the UI, or add new tests:

$ npm run cypress:open

How to test the Configuration API

To test GraphQL is mandatory to set up the Configuration API first, once completed:

$ cd configuration-api
$ npm install
$ npm test

The results of the tests will be visible on the console