Git Product home page Git Product logo

flask-zerokauth's Introduction

Flask-ZeroKAuth

An alternative "securer" login library for flask.

This library implements a zero knowledge login protocol know as the Secure Remote Password protocol (SRP6a, to be exact). The interesting thing about this protocol is that instead of storing a hash of your password and a salt, flask-ZeroKAuth will only store enough information for a user to be able prove that they know their password. Nothing more. This means if your database gets hacked, your user's passwords will not be comprimised!

How is that possible?!

Its actually quite simple to understand, read this! Seriously though, if this is all new to you just use Flask-Login. This is expiremental software.

References Used

To build this extension we based our implemenation off of three things:

Installation

You can install the package from pip using this command:

pip install flask-zerokauth

Usage

This application mimics the functionality and api of Flask-Login. Therefore we use the following conventions

"""This example assumes db is your hook into persistent data storage"""
from flask_zerokauth import LoginManager, login_required, logout_user, login_route
from flask import Flask, render_template


app = Flask()

login_manager = LoginManager(app)

@app.route('/admin')
@login_required
def admin():
    return "Only a logged in user can visit this url"

@app.route('/login')
@login_route
def login():
    return render_template('login.html')

@app.route('/logout')
def logout():
    logout_user()
    return "This clears a logged in users session"

@login_manager.get_credentials
def get_creds(username):
    return db.get(username).creds

@login_manager.commit_user
def add_creds(username, credentials):
    user = db.get(username)
    user.creds = credentials
    db.commit()

@login_manger.get_handshake
def get_handshake(username):
    return db.get(username).hs_params

@login_manager.store_handshake
def store_users_handshake(username, params):
    user = db.get(username)
    user.hs_params = params
    db.commit()

LICENSE

BSD

flask-zerokauth's People

Contributors

alexkuck avatar nskelsey avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

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.