-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added JWT auth + /pyewatercycle endpoint #29
base: main
Are you sure you want to change the base?
Changes from all commits
914a2bb
5f72e37
5e8c133
06ca45c
302d42f
431299b
e8bba84
1d37b68
69eeaaa
8ec31ce
a0b5ec6
174ffca
53cde10
cee61d0
ab4f1e8
4f6a6ee
fa5cfbf
ead304d
6e5a603
23b9912
f9631d4
7fba6a5
d0e9e29
29d6554
76c28ce
466ec43
10ea71e
9a2dfff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,10 +18,12 @@ Instructions below have been tested on Linux, but should also work on OSX and Wi | |
|
||
The experiment launcher requires a JupyterHub server. | ||
|
||
JupyterHub requires a NodeJS preferable installed in users home directory with [nvm](https://github.com/nvm-sh/nvm). | ||
|
||
JupyterHub can be installed with the following commands | ||
```bash | ||
pip3 install jupyterhub jupyterlab | ||
sudo npm install -g configurable-http-proxy | ||
npm install -g configurable-http-proxy | ||
``` | ||
|
||
JupyterHub must accept calls from the experiment launcher service to start a notebook server for any hub user and upload a notebook. | ||
|
@@ -84,16 +86,23 @@ To start launcher use | |
```bash | ||
# JUPYTERHUB_URL is URL where JupyterHub is running. If path like `/jupyter` then origin header is appended. | ||
export JUPYTERHUB_URL=http://172.17.0.1:8000 | ||
# JWT_SECRET is secret with which JWT tokens are encoded/decoded | ||
export JWT_SECRET=$(openssl rand -hex 32) | ||
# Root directory where read only forcings can be found | ||
export FORCING_ROOT_DIR=/mnt/data/forcing | ||
gunicorn -w 4 -b 0.0.0.0:8888 ewatercycle_experiment_launcher.serve:app | ||
``` | ||
|
||
Goto http://localhost:8888/ui/ for Swagger UI. | ||
|
||
The JupyterHub and Experiment Launcher both use local OS accounts for authentication and authorization. | ||
To generate a notebook you need to | ||
1. POST to /auth with Basic authentication to receive a JWT token | ||
2. POST to a notebook path, like /hello, with `Authorization: Bearer <jwt token>` header. | ||
Comment on lines
+99
to
+101
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Getting 401 unauthorized for everything I try (WSL problem?) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, JH uses the OS user accounts to authenticated against. Which works on my linux box. Not sure how accounts work in WSL. Mabye add user with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still no luck |
||
|
||
In the Swagger UI you must authorize before trying an operation. | ||
In the Swagger UI you must authorize twice before trying a path. | ||
|
||
When running on Internet make sure https is enforced so the authentication is secure. | ||
When running on Internet make sure https is enforced, so the authentication is secure. | ||
|
||
The webservice by default runs on `/` base path. This can be changed by setting the `BASE_PATH` environment variable. | ||
For example `export BASE_PATH=/launcher` will host the Swagger UI on http://localhost:8888/launcher/ui/ . |
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the sudo on L24 is not needed. Might be better to avoid.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On L54 I get failed authentication (on WSL2)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sudo is needed for nodejs installed with apt. Switched to https://github.com/nvm-sh/nvm