Skip to main content
https://travis-ci.com/timheap/flask-saml2.svg?branch=master https://badge.fury.io/py/flask-saml2.svg https://readthedocs.org/projects/flask-saml2/badge/?version=latest

This Flask plugin provides functionality for creating both SAML Service Providers and Identity Providers. Applications can implement one or both of these providers.

flask-saml2 works with Flask 1.0+ and Python 3.6+.

This is a heavily modified fork of NoodleMarkets/dj-saml-idp which in turn is a fork of deforestg/dj-saml-idp which in turn is a fork of novapost/django-saml2-idp.

Terminology

For a full description of how SAML works, please seek guides elsewhere on the internet. For a quick introduction, and a run through of some of the terminology used in this package, read on.

The SAML protocal is a conversation between two parties: Identity Providers (IdP) and Service Providers (SP). When an unauthenticated client (usually a browser) accesses a Service Provider, the Service Provider will make an authentication request (AuthnRequest), sign it using its private key, and then forward this request via the client to the Identity Provider. Once the client logs in at the central Identity Provider, the Identity Provider makes a response, signs it, and forwards this response via the client to the requesting Service Provider. The client is then authenticated on the Service Provider via the central Identity Provider, without the Service Provider having to know anything about the authentication method, or any passwords involved.

Example implementations

A minimal but functional example implementation of both a Service Provider and an Identity Provider can be found in the examples/ directory of this repository. To get the examples running, first clone the repository and install the dependencies:

$ git clone https://github.com/timheap/flask-saml2
$ cd flask-saml2
$ python3 -m venv venv
$ source venv/bin/activate
$ pip install -e .
$ pip install -r tests/requirements.txt

Next, run the IdP and the SP in separate terminal windows:

$ cd flask-saml2
$ source venv/bin/activate
$ ./examples/idp.py
$ cd flask-saml2
$ source venv/bin/activate
$ ./examples/sp.py

Finally, navigate to http://localhost:9000/ to access the Service Provider landing page.

Testing

The test runner is pytest and we are using tox to run tests against different versions of Flask and Python. The test can be run locally using tox directly (preferably in a virtual environment):

$ pip install tox
$ tox

License

Distributed under the MIT License.

Metadata

Release files for flask-saml2-fork 0.3.5

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-saml2-fork 0.3.5
File Size Uploaded
flask_saml2_fork-0.3.5.tar.gz 32.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flask-saml2-fork 0.3.5
File Interpreter ABI Platform
flask_saml2_fork-0.3.5-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 74.2 kB

Release files / flask_saml2_fork-0.3.5.tar.gz

Download URL flask_saml2_fork-0.3.5.tar.gz
Size 32.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2d4e37ce8102c3738df8d7f23664847ed2d73efef85b63c9c6cf01e7e7a82d83
BLAKE2b-256 checksum
How to use checksums
748265912f2dc9c74492fdbe6d87ad05fff440c3347cb5d226e709e9674c4876
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / flask_saml2_fork-0.3.5-py2.py3-none-any.whl

Download URL flask_saml2_fork-0.3.5-py2.py3-none-any.whl
Size 41.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
8c337f41034eb18ce032aa4024c2cbd144b8ddc649d4a28fb66650f8c6356e89
BLAKE2b-256 checksum
How to use checksums
91068ac260dea94ebae987f5c0d8993cabdb5a16b7ad82c0f1812d2188e972ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release history Release notifications | RSS feed

This release

0.3.5 This release

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

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