Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Django OAuth Toolkit extension to restrict the scopes available for an application.

License

Notifications You must be signed in to change notification settings

cedadev/dot-restrict-scopes

Repository files navigation

dot-restrict-scopes

Django OAuth Toolkit extension to restrict the scopes available for an application.

Installation

Just install directly from Github using using pip:

pip install -e git+https://github.com/cedadev/dot-restrict-scopes.git@tag_branch_or_commit_hash#egg=dot_restrict_scopes

Usage

The restricted application must be enabled in your settings.py:

# Add dot_restrict_scopes to INSTALLED_APPS
INSTALLED_APPS = [
    # ...
    'dot_restrict_scopes',
]

# Tell Django OAuth Toolkit to use the RestrictedApplication model
OAUTH2_PROVIDER_APPLICATION_MODEL = 'dot_restrict_scopes.RestrictedApplication'

# Tell Django OAuth Toolkit to use the scopes backend
OAUTH2_PROVIDER = {
    'SCOPES_BACKEND_CLASS': 'dot_restrict_scopes.scopes.RestrictApplicationScopes',
    # ...
}

# Tell dot-restrict-scopes which scopes backend it is wrapping
# NOTE: oauth2_provider.scopes.SettingsScopes is the default, so this is not
#       strictly necessary if you want to use scopes from settings
DOT_RESTRICT_SCOPES = {
    'WRAPPED_SCOPES_BACKEND_CLASS': 'oauth2_provider.scopes.SettingsScopes',
}

About

Django OAuth Toolkit extension to restrict the scopes available for an application.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages