Giter Site home page Giter Site logo

demo-rp's Introduction

Portier Relying Party Demo

This is a minimal Python implementation of a Portier Relying Party. To get started, you need Python 3.4 or newer.

python3 -m venv ./venv
./venv/bin/pip install -r requirements.txt
./venv/bin/python3 ./server.py

Configuration

By default, this demo listens on http://localhost:8000 and delegates to the production Portier Broker at https://broker.portier.io. This should be sufficient for local development and testing of this demo.

To override these values, you can either modify the config.ini file (there is an example in config.ini.dist), or set environment variables.

Environment variables always take precedence over config.ini.

config.ini Environment Variable Default Value
ListenIP DEMO_LISTEN_IP 127.0.0.1
ListenPort DEMO_LISTEN_PORT 8000
WebsiteURL DEMO_WEBSITE_URL http://localhost:8000
BrokerURL DEMO_BROKER_URL https://broker.portier.io
RedisURL DEMO_REDIS_URL (none - uses FakeRedis)
Secret DEMO_SECRET (none - generates one)

About Redis

To prevent replay attacks, this demo needs to be able to store and retrieve a nonce for each login attempt. Redis is a great choice for this, since all its operations are atomic and it supports time-based expiration of data.

For production deployments of this demo, you must provide a Redis server via the RedisURL setting. For local testing, this demo uses FakeRedis.

Deploying on Heroku

In addition to the environment variables above, this demo will attempt to detect available metadata when deployed on Heroku.

If $PORT is set, the app will bind to 0.0.0.0:${PORT} by default. This can be overriden by setting the DEMO_LISTEN_IP and DEMO_LISTEN_PORT environment variables.

If Dyno Metadata is enabled for your application, the WebsiteURL will default to the hostname https://${HEROKU_APP_NAME}.herokuapp.com. This can still be overridden by setting the DEMO_WEBSITE_URL environment variable.

If you are using Redis To Go, RedisGreen, RedisCloud, Heroku Redis, or openredis with your deployment, this demo will automatically detect and default the first provider it finds from that list. This can still be overridden by setting the DEMO_REDIS_URL environment variable.

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.