Skip to main content

Extension that renews an OAuth2 token

Project description

SwanOauthRenew

This is a server extension that fetches the oAuth tokens available in the "user" endpoint of the JupyterHub API (1) and stores them in files that can be accessed by other processes (like the EOS client). It can be configured to take any token from the auth state dictionary and write it with any content format.

(1) For now, this functionality is exclusive to SwanHub (our JH wrapper). It does not work on vanilla JH, as the auth state is only available to admins.

Requirements

  • notebook

Install

pip install swanoauthrenew

Usage

Configure the server extension to load when the notebook server starts

 jupyter serverextension enable --py --user swanoauthrenew

Then is necessary to configure (in the jupyter config file) the files that need to be written, from where the tokens are coming from and how the file content should look like. Like so:

c.SwanOauthRenew.files = [
        ('/tmp/swan_oauth.token', 'access_token', '{token}'),
        ('/tmp/cernbox_oauth.token', 'exchanged_tokens/cernbox-service', '{token}'),
        ('/tmp/eos_oauth.token', 'exchanged_tokens/eos-service', 'oauth2:{token}:auth.cern.ch')
    ]

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

swanoauthrenew-1.0.2.tar.gz (4.0 kB view hashes)

Uploaded Source

Built Distribution

swanoauthrenew-1.0.2-py3-none-any.whl (4.4 kB view hashes)

Uploaded Python 3

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