Skip to main content

An extension to add support for separate resource server authentication to authlib

Project description

Flask-Authlib-Client

Build Status

Flask-Authlib-Client is a Flask extension that adds support for separate authorization/resource servers. It extends authlib's flask integration. This extension is heavily inspired by django-oauth-toolkit

Install

$ pip install Flask-Authlib-Client

Usage

from flask import Flask
from authlib.integrations.flask_client import OAuth
from flask_authlib_client import AuthClient


class Config:
    # Other configurations
    RESOURCE_SERVER_INTROSPECTION_URL = 'http://someurl'
    RESOURCE_SERVER_INTROSPECTION_CREDENTIALS = ('test', 'test') # Client id and secret to authorization server



app = Flask(__name__)
app.config.from_object(Config)
oauth = OAuth(app)
ac = AuthClient(app, oauth)

# protect your endpoints
@app.route('/')
@ac.require_oauth()
def example():
    return 'Ok'

@app.route('/')
@ac.require_oauth('home') # Specify scope
def example():
    return 'Ok'

Issues

Feel free to raise any issue here.

Contributions

All contributions are welcome:smile:.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for Flask-Authlib-Client, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size Flask_Authlib_Client-0.0.1-py3-none-any.whl (3.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size Flask-Authlib-Client-0.0.1.tar.gz (2.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page