Skip to main content

Jupyter authentication plugin that checks for account existence and VPN roles.

Project description

CRC JupyterHub Authenticator

The crc_jupyter_auth package is a Jupyter authentication plugin for redirecting users based on their account status and VPN role. The utility is based on the jhub_remote_user_authenticator package originally created for more general applications. The CRC version builds on the original utility by providing significantly improved test coverage and a refined set of configuration options.

How It Works

The authentication plugin checks incoming authentication requests and routes users based on the associated header values. The name of the inspected headers and the routing destination are configurable via the standard Jupyter config file.

Installation and Setup

The crc_jupyter_auth package can be installable via the pip package manager.

pip install crc-jupyter-auth

After installing the package, you will need to update the authenticator_class option in your Jupyter configuration file. To enable basic authentication capabilities and request routing, specify the RemoteUserAuthenticator class:

c.JupyterHub.authenticator_class = "crc_jupyter_auth.RemoteUserAuthenticator"

To enable the same functionality plus local account management, use RemoteUserLocalAuthenticator:

c.JupyterHub.authenticator_class = "crc_jupyter_auth.RemoteUserLocalAuthenticator"

The RemoteUserLocalAuthenticator class provides the same authentication functionality as RemoteUserAuthenticator but is derived from Jupyter's built-in LocalAuthenticator class. This provides extra features such as the ability to add local accounts through the admin interface.

Package Configuration

The authenticator works by fetching the authenticated username from the HTTP header Cn. If found, and not blank, the client will be logged in as that user. Otherwise, the user is redirected.

The HTTP header names and failure redirects are configurable via the Jupyter settings file. Setting names and default values are provided in the table below:

Setting Name Default Description
username_header "Cn" HTTP header name to inspect for the authenticated username -
vpn_header "isMemberOf" HTTP header name to inspect for the user VPN role(s).
required_vpn_role "" Required VPN role for accessing the service. Ignored if an empty string.
missing_user_redirect "" Redirect URL if the user has no home directory. Defaults to 404 if empty string.
missing_role_redirect "" Redirect URL if the user is missing the required VPN header. Defaults to 404 if empty string.

To modify a settings value, use the c.Authenticator object in the configuration file. For example:

c.Authenticator.missing_role_redirect = "https://my.redirect.domain"

If your system assigns multiple VPN roles to users and more than a single role is reported by the header vpn_header, the VPN roles should be provided in the header as a semicolon-delimited list (e.g., role1;role2).

Architecture and Security Recommendations

This authenticator relies on HTTP headers that can be spoofed by a malicious client. To protect against this, an authenticating proxy should be placed in front of Jupyterhub. The JupyterHub daemon should only be accessible from the proxy and never directly accessible by a client.

The authenticating proxy should remove any HTTP headers from incoming requests and only apply headers to proxied requests that have been properly authenticated.

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

crc_jupyter_auth-1.0.5.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

crc_jupyter_auth-1.0.5-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file crc_jupyter_auth-1.0.5.tar.gz.

File metadata

  • Download URL: crc_jupyter_auth-1.0.5.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for crc_jupyter_auth-1.0.5.tar.gz
Algorithm Hash digest
SHA256 e8bea69304e4bd28e1164b8b51d6c8f0deb15720bac945457f424a8b392c22ad
MD5 58d7ca80def7a5d06393b3d60ef0455e
BLAKE2b-256 b31a7f72159b043b04990592fb8241101b75c9e1b6d974c36f4adcecae6baa49

See more details on using hashes here.

File details

Details for the file crc_jupyter_auth-1.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for crc_jupyter_auth-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c3d01aa6696513380bc69dd9a1e8d0cc3c0c8de2d5129bdd203d35bc830e510b
MD5 3f4812a5519e92a181c1142225967046
BLAKE2b-256 e7d843a03b7a372c8ac961443fb42d6b439a6771c7d235cf3a8faae003bde557

See more details on using hashes here.

Supported by

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