# 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
```bash
pip install swanoauthrenew
```
## Usage
Configure the server extension to load when the notebook server starts
```bash
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:
```python
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')
]
```
Raw data
{
"_id": null,
"home_page": "https://github.com/swan-cern/jupyter-extensions",
"name": "swanoauthrenew",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "Jupyter, Notebooks, SWAN, CERN",
"author": "SWAN Admins",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/49/f0/32040562f7d316f7d64166a0fc03d1838d6e7b42991879c75d2fdcc81c64/swanoauthrenew-1.0.2.tar.gz",
"platform": "Linux",
"description": "# SwanOauthRenew\n\nThis 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.\n\n(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.\n\n## Requirements\n\n* notebook\n\n## Install\n\n```bash\npip install swanoauthrenew\n```\n\n## Usage\n\nConfigure the server extension to load when the notebook server starts\n\n```bash\n jupyter serverextension enable --py --user swanoauthrenew\n```\n\nThen 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:\n\n```python\nc.SwanOauthRenew.files = [\n ('/tmp/swan_oauth.token', 'access_token', '{token}'),\n ('/tmp/cernbox_oauth.token', 'exchanged_tokens/cernbox-service', '{token}'),\n ('/tmp/eos_oauth.token', 'exchanged_tokens/eos-service', 'oauth2:{token}:auth.cern.ch')\n ]\n```\n",
"bugtrack_url": null,
"license": "AGPL-3.0",
"summary": "Extension that renews an OAuth2 token",
"version": "1.0.2",
"project_urls": {
"Homepage": "https://github.com/swan-cern/jupyter-extensions"
},
"split_keywords": [
"jupyter",
" notebooks",
" swan",
" cern"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0fca468e8982232e0bbf99340cd9e3a4ba4432f6518a509014e0440cf689c376",
"md5": "3ef93d23398b85434815d3a0ff3dacd1",
"sha256": "fcd1be619126b88e5226b5ad5bbe925fb3426d576e16412faae16f9480357475"
},
"downloads": -1,
"filename": "swanoauthrenew-1.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3ef93d23398b85434815d3a0ff3dacd1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 4427,
"upload_time": "2024-06-18T08:36:09",
"upload_time_iso_8601": "2024-06-18T08:36:09.834703Z",
"url": "https://files.pythonhosted.org/packages/0f/ca/468e8982232e0bbf99340cd9e3a4ba4432f6518a509014e0440cf689c376/swanoauthrenew-1.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "49f032040562f7d316f7d64166a0fc03d1838d6e7b42991879c75d2fdcc81c64",
"md5": "b9859f7bb8733e37fb3df9d6f7f0dfd1",
"sha256": "26377710ebf68a9a7665e99aa5d8008d3c7eda860ad4c962ff76757722e5ee7b"
},
"downloads": -1,
"filename": "swanoauthrenew-1.0.2.tar.gz",
"has_sig": false,
"md5_digest": "b9859f7bb8733e37fb3df9d6f7f0dfd1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4021,
"upload_time": "2024-06-18T08:36:11",
"upload_time_iso_8601": "2024-06-18T08:36:11.189246Z",
"url": "https://files.pythonhosted.org/packages/49/f0/32040562f7d316f7d64166a0fc03d1838d6e7b42991879c75d2fdcc81c64/swanoauthrenew-1.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-18 08:36:11",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "swan-cern",
"github_project": "jupyter-extensions",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "swanoauthrenew"
}