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.

Source Distribution

Flask-Authlib-Client-0.0.1.tar.gz (2.9 kB view hashes)

Uploaded Source

Built Distribution

Flask_Authlib_Client-0.0.1-py3-none-any.whl (3.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page