Skip to main content

datalaboauthenticator

Custom Oauthenticator to manage the Oauth2 process in the datalab project. This authenticator gives users coming from the portal an automatic user account to access their jupyter session without having to login again in the OpenID provider.

This authenticafor inherits from the Generic Authenticator and it has been tested through our internal Keycloak instance.

Installation

Manual

Download and install the repository inside the image used to deploy the jupyterhub session.

git clone https://github.com/aidaph/datalaboauthenticator
pip install .

Configuration in jupyterhub config

Define the following lines in the jupyterhub_config.py file:

c.JupyterHub.authenticator_class = "datalab-oauth"
c.DatalabOAuthenticator.client_id = 'datalab-client' # oauth2 client id for your app
c.DatalabOAuthenticator.client_secret = 'datalab-secret' # oauth2 client secret for your app
c.DatalabOAuthenticator.login_service = "SSO"
c.DatalabOAuthenticator.authorize_url = "https://sso.ifca.es/auth/realms/datalab/protocol/openid-connect/auth"
c.DatalabOAuthenticator.token_url = 'https://sso.ifca.es/auth/realms/datalab/protocol/openid-connect/token' # oauth2 provider's token url
c.DatalabOAuthenticator.userdata_url = 'https://sso.ifca.es/auth/realms/datalab/protocol/openid-connect/userinfo' # oauth2 provider's endpoint with user data
c.DatalabOAuthenticator.oauth_callback_url = 'https://{}.datalab.ifca.es/hub/oauth_callback'.format(os.environ['NAMESPACE'])
c.DatalabOAuthenticator.scope = ["profile","openid", "email", "groups"]
c.DatalabOAuthenticator.userdata_params = {"state": "state"} # params to send for userdata endpoint
c.DatalabOAuthenticator.username_claim = "email"
c.DatalabOAuthenticator.allowed_groups = ["dummy"]
c.DatalabOAuthenticator.username_key = "preferred_username" # username key from json returned from user data endpoint
c.DatalabOAuthenticator.extra_authorize_params = {"token": '{}'.format(os.environ["ACCESS_TOKEN"])}

Take into account that the authenticator makes the auto_login as soon as the user comes from the portal without showing the Log in button. This behavior can be swittched off turning the DatalabOAuthenticator.auto_login" option to False`.

Metadata

Release files for jupyterhub-datalaboauthenticator 1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jupyterhub-datalaboauthenticator 1.0
File Size Uploaded
jupyterhub-datalaboauthenticator-1.0.tar.gz 7.5 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for jupyterhub-datalaboauthenticator 1.0
File Interpreter ABI Platform
jupyterhub_datalaboauthenticator-1.0-py3-none-any.whl Python 3 none any Details
jupyterhub_datalaboauthenticator-1.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 24.1 kB

Release files / jupyterhub-datalaboauthenticator-1.0.tar.gz

Download URL jupyterhub-datalaboauthenticator-1.0.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2ebc716ee2200a453f3a076aa8f8ec445397343726b95a80666d9159fec1273f
BLAKE2b-256 checksum
How to use checksums
349b06a526d889f34bfd180fba08cc622483a6988dd1f198eba34a852d482cc0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release files / jupyterhub_datalaboauthenticator-1.0-py3-none-any.whl

Download URL jupyterhub_datalaboauthenticator-1.0-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
055a49e813424bf1c7c1cc4f5cf4bd6b04b298d570e13f3b3c3b76e43ac403f3
BLAKE2b-256 checksum
How to use checksums
8b20a110e1a8ddcfc9e9486cea92a16a594991dc32a5b24fdab1d5b5b8881e9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release files / jupyterhub_datalaboauthenticator-1.0-py2.py3-none-any.whl

Download URL jupyterhub_datalaboauthenticator-1.0-py2.py3-none-any.whl
Size 8.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
2d85d617ec0d9bb750359a3d618b60c4d21a6b8b6cecc06bbe138e38d7e39848
BLAKE2b-256 checksum
How to use checksums
0e9772467adeda566fbc4adfad82cab9cf59103c25b7f80378cc2a4e0088f9c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release history Release notifications | RSS feed

This release

1.0 This release

3 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