No project description provided
Project description
Jupyterhub SAML Auth
Authenticate your Jupyterhub users using SAML. This authenticator uses OneLogin's python3-saml package as a backend API for handling SAML authentication.
Installation
pip install jupyterhub-saml-auth
Configuration
See the jupyterhub_config.py
example configuration below for how to integrate this package with jupyterhub
def extract_username(acs_handler, attributes):
email = attributes['email'][0]
username = email.split('@')[0]
return username
# The configuration path is for OneLogin's python3-saml package. This directory is where
# settings.json & advanced_settings.json go. See https://github.com/onelogin/python3-saml
# for more info about this
c.SAMLAuthenticator.saml_settings_path = '/app/etc'
# The cookies that your IdP uses for maintaining a login session. These will be cleared
# once the user hits 'logout'
c.SAMLAuthenticator.session_cookie_names = {'PHPSESSIDIDP', 'SimpleSAMLAuthTokenIdp'}
# Function that extracts the username from the SAML attributes.
c.SAMLAuthenticator.extract_username = extract_username
# register the SAML authenticator with jupyterhub
c.JupyterHub.authenticator_class = 'jupyterhub_saml_auth.SAMLAuthenticator'
Development
Prerequisite software
- docker
- docker compose
- python3
- Firefox or Chrome
Create a development environment
# at project root
python3 -m venv .
source bin/activate
pip install -r requirements.txt
# OPTIONAL, install package if developing source code
pip install -e .
pytest test/unit # run the unit tests
Test the authentication process
The acceptance test starts the application as a Docker container. Start the containers with docker compose up -d
prior to running the acceptance test with the command pytest test/test_acceptance.py
. See conftest.py
for a list of command line switches/flags to run the acceptance tests.
Kill your docker environment
To kill the docker containers, run the command docker compose down
at the project root.
References
https://github.com/onelogin/python3-saml
https://goteleport.com/blog/how-saml-authentication-works/
https://medium.com/@BoweiHan/elijd-single-sign-on-saml-and-single-logout-624efd5a224
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
Built Distribution
Hashes for jupyterhub_saml_auth-0.2.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec35153d8421d68339336f67f5804fa01c17ed8e0dcbeebe97a935075d7a4f43 |
|
MD5 | e51d75974d82105170c326da8c7e8f05 |
|
BLAKE2b-256 | d9072e8b7a124f434d33839d5afac327f28ebe83156240b2dc2c38df4a2b21ec |
Hashes for jupyterhub_saml_auth-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef990d784aab79029f9800f7ab3aee6a1d92c55f347685a9e79417ab87c2c1fc |
|
MD5 | 8c3a2febe6ba772891fb754bc0c969d6 |
|
BLAKE2b-256 | 3db8867c94850a43083decbc5cd8246c0ccabcf82d6b1b228a6a6eb6ffb9aeee |