This repository provides Flask applications with the capability to integrate SAML (Security Assertion Markup Language) authentication seamlessly.
The repository consists of two main files:
-
app.py: This file contains the main Flask application code for handling SAML authentication. It defines routes for login, logout, and user profile, and includes configuration for SAML Service Provider (SP) and Identity Providers (IdPs). The
ExampleServiceProvider
class extendsServiceProvider
fromflask_saml2.sp
and defines methods for retrieving logout and login return URLs. -
demo.py: This file serves as a demonstration of Flask SAML integration. It also contains Flask application code for handling SAML authentication. Similar to
app.py
, it defines routes for login, logout, and user profile, and includes configuration for SAML SP and IdPs. Additionally, it demonstrates dynamic addition of IdPs using a route/add_idp
.
To use this repository:
- Install Flask and Flask-SAML:
pip install flask
pip install flask-saml
-
Choose either
app.py
ordemo.py
as the basis for your Flask application. -
Customize the SAML configuration in the chosen file according to your IdP setup.
-
Run your Flask application.
Contributions to this repository are welcome. If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.