An open API service indexing awesome lists of open source software.

https://github.com/abe-winter/oflex

Stack-specific flask extensions for auth & connection pooling
https://github.com/abe-winter/oflex

flask login

Last synced: 3 months ago
JSON representation

Stack-specific flask extensions for auth & connection pooling

Awesome Lists containing this project

README

        

# Oflex

O(pinionated) fl(ask) ex(tensions).

Flask login and connection-pooling stuff that I reuse in all my prototyping. The one-line goal of this project is to have drop-in login, however inflexible, rather than spending 6 hours setting it up every time.

This is only compatible with my postgres / redis stack and a similar DB users schema.

Will happily add docs if anyone else needs this, post a github issue to LMK.

## Features

These things wouldn't normally belong together and are only bound together by the common themes of (1) me needing them every time (2) I haven't found a right-fit library to do any of them in flask (3) they're all difficult to integrate automatically without some schema / template / backend assumptions.

* [x] flask blueprints for create-account and login pages
* [x] and scrypt passwords
* [x] and twilio login
* [x] login-required decorator which populates `flask.g.session`
* [x] graphene / graphql middleware login-required
* [ ] HSTS middleware
* [x] postgres & redis initializer
* [x] postgres connection pool context manager
* [ ] basic RBAC
* [ ] werkzeug remote IP
* [ ] in-memory and redis rate limiting
* [ ] email verification
* [ ] invitations & preapproval lists
* [ ] oauth
* [ ] add sample schema

## What you should do to use this

* Look in `config.py` in this repo and make sure your SQL users table and environment variables conform to what this package expects.
* (You can customize the configs, but that's a waste)
* use `flask.current_app.pool` or `pool.withcon`, and `flask.current_app.redis` in your thing
* You have a base.htm template that defines styles, headers, etc

## Consider also

These other flask login libraries that I haven't evaluated at all:

* https://github.com/mattupstate/flask-security
* https://github.com/lingthio/Flask-User
* https://github.com/maxcountryman/flask-login

There are a lot of these because schema integration is difficult.