Skip to main content

Flask-OlinAuth

Flask-OlinAuth implements OlinApps auth. It automatically provides a /olinauthlogin and /olinauthlogout route to the application, handling the process of actually authenticating a user with olinapps.

At a high level, Flask-OlinAuth provides two useful pieces for your application, both of which are demonstrated in example.py.

@auth_required

A simple function decorator which ensures that a user is logged in before a view is shown. The user is redirected to the login portal, with correct arguments, if not.

current_user

A nice local proxy for all of your views to get the current user, formatted as a dictionary.

logout_user

Will log out the currently authenticated user, allowing you to simply create your own logout view.

Flask-OlinAuth is very heavily inspired by Flask-Login, with structure, and functionality adopted, and much knowledge gained.

Installation

Install the extension with one of the following commands:

$ easy_install flask-olinauth

or alternatively if you have pip installed (which you should):

$ pip install flask-olinauth

Example Usage

from flask import Flask, url_for
from flask.ext.olinauth import OlinAuth, auth_required, current_user
app = Flask(__name__)

SECRET_KEY = "yeah, not actually a secret"
DEBUG = True

app.config.from_object(__name__)

oa = OlinAuth(app, 'localhost:5000')
#initial OlinAuth, with callback host of localhost:5000, for local server
oa.init_app(app, 'localhost:5000')


@app.route("/")
def index():
    if current_user:
        responseString = "Awesome index, guess what? %s is logged in. Sweet, right?" % current_user['id']
    else:
        responseString = "<html>It is kind of lonely here... No users are logged in. <a href=%s>Checkout my secret</a> </html>" % url_for('secret')
    return responseString


@app.route("/secret")
@auth_required
def secret():
    return "I wouldn't normally show you this, but since %s is logged in, here is the secret: 42" % current_user['id']


if __name__ == "__main__":
    app.run(debug=True)

Metadata

Release files for Flask-OlinAuth 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Flask-OlinAuth 1.0.1
File Size Uploaded Provenance
Flask-OlinAuth-1.0.1.zip 8.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for Flask-OlinAuth 1.0.1
File Interpreter ABI Platform
Flask-OlinAuth-1.0.1.win32.exe Details

Total release size: 211.7 kB

Release files / Flask-OlinAuth-1.0.1.zip

Download URL Flask-OlinAuth-1.0.1.zip
Size 8.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e6b454b9cedcd2231ef4a2f37a54e1976598f219f3d9997fe8a27b1f488d545e
BLAKE2b-256 checksum
How to use checksums
841d60c0c0bf4a745ae7c1c89b1a361fe16d497accd02f6b990eb519ca584056
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / Flask-OlinAuth-1.0.1.win32.exe

Download URL Flask-OlinAuth-1.0.1.win32.exe
Size 203.5 kB
Tags Source
SHA-256 checksum
How to use checksums
41decca287bc9db1b0ff8786041e79f4d118538830554f4ea2e74737a31808f7
BLAKE2b-256 checksum
How to use checksums
f06c1baf2699c0731090d6db11538758e70c398a89c80e19bcf1e80393dff599
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for Flask-OlinAuth 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page