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'
Environment variables
SAML_HTTPS_OVERRIDE: setting this will override the automatic detection ofhttporhttpsto/hub/acsroute and will set it to onlyhttps.
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
Metadata
Release files for jupyterhub-saml-auth 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jupyterhub_saml_auth-0.3.2.tar.gz | 19.8 kB | Without provenance | Details for jupyterhub_saml_auth-0.3.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jupyterhub_saml_auth-0.3.2-py3-none-any.whl | Python 3 | none | any | Details for jupyterhub_saml_auth-0.3.2-py3-none-any.whl |
Total release size: 41.2 kB
Release files / jupyterhub_saml_auth-0.3.2.tar.gz
| Download URL | jupyterhub_saml_auth-0.3.2.tar.gz |
|---|---|
| Size | 19.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2a84749b8a65428933d71b9869898db862dfe89f1e483e8161a1f41437e8dbbe
|
|
BLAKE2b-256 checksum How to use checksums |
ae984a76a8c14aae205cf8e42b857a91919145fad889af1e14a6b5ba037848fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
|
Release files / jupyterhub_saml_auth-0.3.2-py3-none-any.whl
| Download URL | jupyterhub_saml_auth-0.3.2-py3-none-any.whl |
|---|---|
| Size | 21.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c9eac607ab0fa2dde07a2f1d7052bf9d70cf50db221a3107f204c2aeb619bd79
|
|
BLAKE2b-256 checksum How to use checksums |
8e4484fa70e88af3f3f588812bf90125d427cf7e43b1f71da9220887f65dbd57
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
|
Security for jupyterhub-saml-auth 0.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.