Giter Site home page Giter Site logo

jonaphael / auth Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mmagr/auth

0.0 1.0 0.0 3.98 MB

User and token management for dojot

Home Page: http://www.dojot.com.br

License: GNU General Public License v3.0

Dockerfile 0.88% Shell 1.90% Python 96.92% HTML 0.30%

auth's Introduction

dojot Authentication service

This service handles user authentication for the platform. Namely this is used to maintain the set of known users, and their associated roles. Should a user need to interact with the platform, this service is responsible for generating the JWT token to be used when doing so.

Installation

This service depends on a couple of python libraries to work. To install them, please run the commands below. These have been tested on an ubuntu 16.04 environment (same used when generating) the service's docker image.

# you may need sudo for those
apt-get install -y python3-pip
python3 setup.py

Another alternative is to use docker to run the service. To build the container, from the repository's root:

# you may need sudo on your machine: https://docs.docker.com/engine/installation/linux/linux-postinstall/
docker build -t <tag> -f docker/Dockerfile .

Configuration

Database related configuration

Some auth configuration is made using environment variables. On a Linux system one can set a environment variable with the command

  export VAR_NAME=varvalue

on a docker-compose schema, one can set environment variables for a container Append the following configuration

  environment:
      VAR_NAME: "varvalue"

The default value is used if the configuration was not provided The following variables can be set

  • AUTH_DB_NAME
    • database type. Current only postgres is supported

    • default: postgres

    • AUTH_DB_USER

      • The username used to access the database
      • default: auth
    • AUTH_DB_PWD * The password used to access the database * default: empty password

    • AUTH_DB_HOST * The URL used to connect to the database * default: http://postgres

    • AUTH_KONG_URL * The URL where the Kong service can be found * If set to 'DISABLED' Auth won´t try to configure Kong and will generate secrets for the JWT tokens by itself. * default: http://Kong:8001

    • AUTH_TOKEN_EXP * Expiration time in second for generated JWT tokens * default: 420

    • AUTH_TOKEN_CHECK_SIGN * Whether Auth should verify received JWT signatures. Enabling this will cause one extra query to be performed. * default: False

    • AUTH_CACHE_NAME * Type of cache used. Currently only Redis is suported. * If set to 'NOCACHE' auth will work without cache. Disabling cache usage considerably degrades performance. * default: redis

    • AUTH_CACHE_USER * username to access the cache database * default: redis

    • AUTH_CACHE_PWD * password to acces the cache database * default: empty password

    • AUTH_CACHE_HOST * ip or hostname where the cache can be found * default: redis

    • AUTH_CACHE_TTL * Cache entry time to live in seconds * default: 720

    • AUTH_CACHE_DATABASE * cach database name (or number) * default: '0'

If you are running without docker, You will need to create and populate the database tables before the first run.

python3 shell:

>>> from webRouter import db
>>> db.create_all()

Create the initial users, groups and permissions

  python3 initialConf.py

API

The API documentation for this service is written as API blueprints. To generate a simple web page from it, one may run the commands below.

npm install -g aglio # you may need sudo for this

# static webpage
aglio -i docs/auth.apib -o docs/auth.html

# serve apis locally
aglio -i docs/auth.apib -s

Tests

Auth has some automated test scripts. We use Dredd <http://dredd.org/en/latest/>_ to execute them. Check the Dockerfile <./tests/Dockerfile>_ used to build the test image to check how to run it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.