debug
This commit is contained in:
parent
05a02d35b3
commit
c8fe7b1a2a
|
@ -9,53 +9,6 @@ hub:
|
||||||
db:
|
db:
|
||||||
pvc:
|
pvc:
|
||||||
storageClassName: csi-sc-cinderplugin
|
storageClassName: csi-sc-cinderplugin
|
||||||
extraFiles:
|
|
||||||
refresh-token.py:
|
|
||||||
mountPath: /usr/local/etc/jupyterhub/refresh-token.py
|
|
||||||
stringData: |
|
|
||||||
"""A token refresh service authenticating with the Hub.
|
|
||||||
|
|
||||||
This service serves `/services/refresh-token/`,
|
|
||||||
authenticated with the Hub,
|
|
||||||
showing the user their own info.
|
|
||||||
"""
|
|
||||||
import json
|
|
||||||
import os
|
|
||||||
from urllib.parse import urlparse
|
|
||||||
|
|
||||||
from tornado.httpserver import HTTPServer
|
|
||||||
from tornado.ioloop import IOLoop
|
|
||||||
from tornado.web import Application, RequestHandler, authenticated
|
|
||||||
|
|
||||||
from jupyterhub.services.auth import HubAuthenticated
|
|
||||||
|
|
||||||
|
|
||||||
class RefreshHandler(HubAuthenticated, RequestHandler):
|
|
||||||
@authenticated
|
|
||||||
def get(self):
|
|
||||||
user_model = self.get_current_user()
|
|
||||||
self.set_header('content-type', 'application/json')
|
|
||||||
self.write(json.dumps(user_model, indent=1, sort_keys=True))
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
print(os.environ)
|
|
||||||
app = Application(
|
|
||||||
[
|
|
||||||
(os.environ['JUPYTERHUB_SERVICE_NAME'], RefreshHandler),
|
|
||||||
(r'.*', RefreshHandler),
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
http_server = HTTPServer(app)
|
|
||||||
url = urlparse(os.environ['JUPYTERHUB_SERVICE_URL'])
|
|
||||||
|
|
||||||
http_server.listen(url.port, url.hostname)
|
|
||||||
|
|
||||||
IOLoop.current().start()
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
||||||
|
|
||||||
extraConfig:
|
extraConfig:
|
||||||
oauthCode: |
|
oauthCode: |
|
||||||
import time
|
import time
|
||||||
|
@ -193,6 +146,56 @@ hub:
|
||||||
'command': [sys.executable, '/usr/local/etc/jupyterhub/refresh-token.py']
|
'command': [sys.executable, '/usr/local/etc/jupyterhub/refresh-token.py']
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
extraFiles:
|
||||||
|
refresh-token.py:
|
||||||
|
mountPath: /usr/local/etc/jupyterhub/refresh-token.py
|
||||||
|
stringData: |
|
||||||
|
"""A token refresh service authenticating with the Hub.
|
||||||
|
|
||||||
|
This service serves `/services/refresh-token/`,
|
||||||
|
authenticated with the Hub,
|
||||||
|
showing the user their own info.
|
||||||
|
"""
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
|
from tornado.httpserver import HTTPServer
|
||||||
|
from tornado.ioloop import IOLoop
|
||||||
|
from tornado.web import Application, RequestHandler, authenticated
|
||||||
|
|
||||||
|
from jupyterhub.services.auth import HubAuthenticated
|
||||||
|
|
||||||
|
|
||||||
|
class RefreshHandler(HubAuthenticated, RequestHandler):
|
||||||
|
def initialize(self, hub_auth):
|
||||||
|
self.hub_auth = hub_auth
|
||||||
|
|
||||||
|
@authenticated
|
||||||
|
def get(self):
|
||||||
|
user_model = self.get_current_user()
|
||||||
|
self.set_header('content-type', 'application/json')
|
||||||
|
self.write(json.dumps(user_model, indent=1, sort_keys=True))
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
prefix = os.environ.get('JUPYTERHUB_SERVICE_PREFIX', '/')
|
||||||
|
app = Application(
|
||||||
|
[
|
||||||
|
(prefix, RefreshHandler),
|
||||||
|
(r'.*', RefreshHandler),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
http_server = HTTPServer(app)
|
||||||
|
url = urlparse(os.environ['JUPYTERHUB_SERVICE_URL'])
|
||||||
|
|
||||||
|
http_server.listen(url.port, url.hostname)
|
||||||
|
|
||||||
|
IOLoop.current().start()
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
|
||||||
extraEnv:
|
extraEnv:
|
||||||
NEXTCLOUD_DEBUG_OAUTH: "yes"
|
NEXTCLOUD_DEBUG_OAUTH: "yes"
|
||||||
NEXTCLOUD_HOST: sunet.drive.test.sunet.se
|
NEXTCLOUD_HOST: sunet.drive.test.sunet.se
|
||||||
|
|
Loading…
Reference in a new issue