Giter VIP home page Giter VIP logo

nmos-auth-server's Introduction

AMWA NMOS BCP-003-02 Authorisation Server Implementation

A Flask-based implementation of an OAuth2 Authorisation Server based on AMWA NMOS BCP-003-02 using RFC 6749. The API implemented here is a candidate to become the proposed specification AMWA NMOS IS-10.

The server produces access tokens in the form of JSON Web Tokens. Dynamic Client Registration is also supported in line with RFC 7591.

The core of the implementation uses the Authlib Library, and is based on the Authlib OAuth2 Server Example.

Please Check the README.md in the nmosauth directory for more in-depth instructions on starting the AMWA NMOS Authorisation Server and registering a client.

Installation

System Requirements

  • Linux (untested on Windows and Mac)
  • Python 3.x
  • Python Pip3

Python3 Requirements

These should be installed automatically as part of the install process.

  • six
  • nmoscommon
  • Flask
  • sqlalchemy
  • Flask-SQLAlchemy
  • Authlib>=1.1
  • Flask-Cors
  • requests
  • gevent
  • systemd
  • pyopenssl

Python Installation

Due to the installation needing to install files into system directories (/var/nmosauth for system files and /usr/bin for executable files) the --no-binary flag must be set in order to pull the source distribution from PyPi and not a Wheel (built) distribution. To install from pip:

# Install From Pip
$ sudo pip3 install nmos-auth --no-binary nmos-auth

For pip3 installations from source:

# Change to top-level directory
$ cd nmos-auth-server

# Install via pip locally
$ sudo pip3 install . --no-binary nmos-auth

For basic setuptools installations:

# Install Python setuptools
$ sudo pip3 install setuptools

# Install the package
$ cd nmos-auth-server
$ sudo python3 setup.py install

Testing

Testing of the package can be achieved using tox:

# Install tox
sudo pip3 install tox

# Run tests using tox environment for Python3
cd nmos-auth-server
tox -e py3

Debian

For use as a Debian package (on Ubuntu/Debian systems):

make deb
cd dist/
sudo dpkg -i <name of package>.deb

NOTE FOR USE ON R&D NETWORK: If there is a dependency clash during installation, you may need to install python-sqlalchemy using:

sudo apt-get install python-sqlalchemy=1.0.11+ds1-1ubuntu2

NOTE WHEN INSTALLING VIA DEBIAN PACKAGE: The version of cryptography and pyOpenSSL on the Ubuntu Xenial mirrors are out-of-date. Please install both Cryptography and PyOpenSSL via Pip for compatible versions.

Usage

Basic Usage

For pure Python usage:

# Execute service file
$ sudo /usr/bin/nmosauth

If installing via a Debian package (e.g. using apt-get, dpkg, etc), Systemd service files should be placed in system directories. The service can be restarted using:

# Run Service using SystemD
sudo systemctl restart python3-nmos-auth

Getting Started

Please Check the README.md in the nmosauth directory for more in-depth instructions on starting the NMOS Authorisation Server and registering a client.

You can now navigate to http://127.0.0.1:4999/x-nmos/auth/v1.0/home/ to find the Home Page of the authorization server in order to perform any admin tasks, such as registering users and clients.

nmos-auth-server's People

Contributors

andrewbonney avatar dannymeloy avatar jamesgibo avatar simonrankine avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nmos-auth-server's Issues

TypeError: 'module' object is not callable

I'm getting the following error when I try to startup the auth-server inside a docker environment:

root@69d3da24843a:/home/nmos-auth# /usr/bin/nmosauth
2020-05-07 07:10:31,807 : utils : DEBUG : Choosing interface from /etc/nmoscommon/config.json file: []
2020-05-07 07:10:31,807 : utils : DEBUG : Could not find ipp-utils, will try using default gateway interface
2020-05-07 07:10:31,807 : utils : DEBUG : Choosing interface using the default gateway: 172.17.0.2
WARNING:mdnsbridge:This class is deprecated. Please use the matching one in nmos-mdns-bridge instead.
Exception loading config: name 'f' is not defined
Traceback (most recent call last):
  File "/usr/bin/nmosauth", line 7, in <module>
    service.run()
  File "/usr/local/lib/python3.5/dist-packages/nmosauth/auth_server/security_service.py", line 107, in run
    self.start()
  File "/usr/local/lib/python3.5/dist-packages/nmosauth/auth_server/security_service.py", line 64, in start
    gevent.signal(signal.SIGINT, self.sig_handler)
TypeError: 'module' object is not callable

Steps to reproduce:

  • Start docker (docker run -it ubuntu, also tried with 16.04: docker run -it ubuntu:xenial)
  • Update packagemanager: apt update && apt upgrade
  • Install required packages: apt install python3 python3-pip git
  • Create working dir: mkdir /home/nmos-auth and cd /home
  • git clone <this_repo> nmos-auth
  • Install with either method (e.g. pip3 install . --no-binary nmos-auth)
  • Run with /usr/bin/nmos-auth
  • See above error/output

Was somebody able to run this inside a container? I suspect that it runs inside a container is not the problem, but cannot say for sure ofc.

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.