Skip to content

Commit 3965846

Browse files
authored
Merge pull request #55 from shingo78/feature/jupyterhub-5.4
Upgrade JupyterHub to 5.4
2 parents 845b79e + 6e97ff6 commit 3965846

5 files changed

Lines changed: 31 additions & 11 deletions

File tree

auth-proxy/resources/htdocs/php/login.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,13 @@
2121
$_SESSION['username'] = $username;
2222
$_SESSION['authtype'] = 'local';
2323

24-
$next_param = isset($_GET['next']) ? '?next=' . urlencode($_GET['next']) : '';
24+
$login_params = array();
25+
if (isset($_GET['next'])) {
26+
$login_params['next'] = $_GET['next'];
27+
}
28+
$reproxy_url = get_reproxy_url($login_params);
2529
header("X-Accel-Redirect: /entrance/");
26-
header("X-Reproxy-URL: ".HUB_URL.'/'.COURSE_NAME."/hub/login".$next_param);
30+
header("X-Reproxy-URL: $reproxy_url");
2731
header("X-REMOTE-USER: $username");
2832

2933
exit;

auth-proxy/resources/htdocs/php/lti/service.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,9 @@
8484
if ($next) {
8585
$login_params['next'] = $next;
8686
}
87+
$reproxy_url = get_reproxy_url($login_params);
8788

8889
header("X-Accel-Redirect: /entrance/");
89-
$reproxy_url = HUB_URL.'/'.COURSE_NAME."/hub/login";
90-
$query = http_build_query($login_params, '', null, PHP_QUERY_RFC3986);
91-
if ($query) {
92-
$reproxy_url = $reproxy_url.'?'.$query;
93-
}
9490
header("X-Reproxy-URL: $reproxy_url");
9591
header("X-REMOTE-USER: $username");
9692
} else if ($launch->is_deep_link_launch()) {

auth-proxy/resources/htdocs/php/sp.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@
2020
session_regenerate_id(true);
2121
$_SESSION['authtype'] = 'saml';
2222
$username = get_username_from_mail_address($mail_address);
23-
$next_param = isset($_GET['next']) ? '?next=' . urlencode($_GET['next']) : '';
23+
$login_params = array();
24+
if (isset($_GET['next'])) {
25+
$login_params['next'] = $_GET['next'];
26+
}
27+
$reproxy_url = get_reproxy_url($login_params);
2428
header("X-Accel-Redirect: /entrance/");
25-
header("X-Reproxy-URL: ".HUB_URL.'/'.COURSE_NAME."/hub/login".$next_param);
29+
header("X-Reproxy-URL: $reproxy_url");
2630
header("X-REMOTE-USER: $username");
2731
} else {
2832
// redirect to message page

auth-proxy/resources/lib/functions.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,19 @@ function generate_password($length = 10)
121121
}
122122
return $password;
123123
}
124+
125+
function get_reproxy_url($params)
126+
{
127+
$reproxy_url = HUB_URL;
128+
if (! empty(COURSE_NAME)) {
129+
$reproxy_url .= '/';
130+
$reproxy_url .= COURSE_NAME;
131+
}
132+
$reproxy_url .= '/hub/login';
133+
$query = http_build_query($params, '', null, PHP_QUERY_RFC3986);
134+
if ($query) {
135+
$reproxy_url .= '?';
136+
$reproxy_url .= $query;
137+
}
138+
return $reproxy_url;
139+
}

jupyterhub/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM jupyterhub/jupyterhub:5.2 AS builder
1+
FROM jupyterhub/jupyterhub:5.4 AS builder
22

33
# dev tools
44
RUN apt-get update && \
@@ -44,7 +44,7 @@ RUN python3 -m pip wheel --wheel-dir wheelhouse --constraint requirements \
4444
RUN python3 -m pip wheel --wheel-dir wheelhouse --constraint requirements \
4545
jupyterhub-idle-culler
4646

47-
FROM jupyterhub/jupyterhub:5.2
47+
FROM jupyterhub/jupyterhub:5.4
4848

4949
# dind
5050
RUN apt-get update && \

0 commit comments

Comments
 (0)