Skip to main content

Flask-Multipass provider for Authentik

Project description

Flask-Multipass-Authentik

This package provides the authentik authentication and identity providers for Flask-Multipass. Inspired & adapted from flask-multipass-authentik

AuthentikAuthProvider This provider is a simple wrapper around AuthlibAuthProvider, since Authentik works well with the standard authlib provider in flask-multipass.

AuthentikIdentityProvider This provider gives access to group information and members via Authentik REST API.

Install

pip install flask-multipass-authentik

Usage

Configuration

The configuration follows the standard Flask-Multipass way and the Authentik specific part placed into the authentik_args section.

MULTIPASS_AUTH_PROVIDERS = {
    'authentik': {
        'type': 'authentik',
        'title': 'Authentik Auth Provider',
        'authlib_args': {...}
    }
}

MULTIPASS_IDENTITY_PROVIDERS = {
    'authentik': {
        'type': 'authentik',
        'title': 'Authentik Identity Provider',
        'identifier_field': 'email',
        'authentik_args': {
            'client_id': '',  # put your client id here
            'client_secret': '',  # put your client secret here
            'client_kwargs': {'scope': 'email openid profile'},
            'api_url': 'https://authentik.tld/api/v3',
            'authorize_url': 'https://authentik.tld/application/o/authorize/', # Replace authentik.tld with your Authentik base URL
            'access_token_url': 'https://authentik.tld/application/o/token/',
            'userinfo_endpoint': 'https://authentik.tld/application/o/userinfo/',
            'jwks_uri': 'https://authentik.tld/application/o/<app-id>/jwks/' # Replace <app-id> with your Authentik application ID
        }
    }
}

The configuration values are following:

  • client_id: The OAuth2 client ID of the Authentik application.
  • client_secret: The OAuth2 client secret of the Authentik application.
  • client_kwargs: Additional arguments passed to the OAuth2 client. The scope key
  • api_url: The base URL of the Authentik API (e.g. https://authentik.tld/api/v3).
  • api_key: An API key for accessing the Authentik API. Required for group membership lookups.
  • authorize_url: The URL to redirect users to for authentication (e.g. https://authentik.tld/application/o/authorize/).
  • access_token_url: The URL to obtain access tokens (e.g. https://authentik.tld/application/o/token/).
  • userinfo_endpoint: The URL to obtain user information (e.g. https://authentik.tld/application/o/userinfo/).
  • jwks_uri: The URL to obtain the JSON Web Key Set (e.g.
  • https://authentik.tld/application/o/<app-id>/jwks/).
  • identifier_field: The field in the user info response to use as the unique identifier for users (e.g. email, username, etc.). Default is email.

Development

In order to develop flask-multipass-authentik, install the project and its dependencies in a virtualenv. This guide assumes that you have the following tools installed and available in your path:

First, clone the repository locally with:

git clone https://github.com/RobotHanzo/flask-multipass-authentik
cd flask-multipass-authentik

Before creating the virtualenv, make sure to be using the same version of Python that the development of the project is targeting. This is the first version specified in the .python-version file and you can install it with pyenv:

pyenv install

You may now create the virtualenv and install the project with its dependencies in it with poetry:

poetry install

Contributing

This project uses GitHub Actions to run the linter on every pull request. You are still encouraged to run the linter locally before pushing your changes.

Run linter checks with:

poetry run -- make lint

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flask_multipass_authentik-0.0.1-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file flask_multipass_authentik-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for flask_multipass_authentik-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 19180f214837f9ed102e321ed271592f0fe3bcdec19051163d852a4e5688516f
MD5 d11f2df279e46d9d365f17ee761d451a
BLAKE2b-256 d8275aafa88f6476cae2cbae63caf65e837174a80ee04b79c1dbc94d23fd9637

See more details on using hashes here.

Provenance

The following attestation bundles were made for flask_multipass_authentik-0.0.1-py3-none-any.whl:

Publisher: releasing.yaml on RobotHanzo/flask-multipass-authentik

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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