Skip to content

Commit

Permalink
Moved from OAuth + bridge to CASAuthenticator
Browse files Browse the repository at this point in the history
  • Loading branch information
Luca De Feo authored and Luca De Feo committed Jun 19, 2019
1 parent d2e20a3 commit afb8a91
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 73 deletions.
10 changes: 0 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,5 @@ services:
- /var/run/docker.sock:/var/run/docker.sock
restart: on-failure

oauth2_server:
image: defeo/cas2oauth2bridge
container_name: c2o2b
volumes:
- ./oauth2/config.js:/home/node/config.js
labels:
- "traefik.enable=true"
- "traefik.frontend.rule=Host:jupyter.ens.uvsq.fr;PathPrefixStrip:/c2o2b/"
restart: on-failure

volumes:
jupyterhub_data:
2 changes: 1 addition & 1 deletion jupyterhub/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ RUN wget https://raw.githubusercontent.com/jupyterhub/jupyterhub/0.9.3/examples/

RUN pip install \
dockerspawner==0.10.0 \
oauthenticator==0.8.0
jhub_cas_authenticator==1.0.0
33 changes: 12 additions & 21 deletions jupyterhub/jupyterhub_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,18 @@
c.Spawner.default_url = '/lab'

## Authenticator
from oauthenticator.oauth2 import OAuthLoginHandler
from oauthenticator.generic import GenericOAuthenticator
from tornado.auth import OAuth2Mixin

class UVSQMixin(OAuth2Mixin):
_OAUTH_AUTHORIZE_URL = 'https://jupyter.ens.uvsq.fr/c2o2b/login'
_OAUTH_ACCESS_TOKEN_URL = 'https://jupyter.ens.uvsq.fr/c2o2b/token'

class UVSQLoginHandler(OAuthLoginHandler, UVSQMixin):
pass

class UVSQAuthenticator(GenericOAuthenticator):
login_service = 'UVSQ'
login_handler = UVSQLoginHandler
client_id = '0'
client_secret = ''
userdata_url = 'https://jupyter.ens.uvsq.fr/c2o2b/userdata'
token_url = 'https://jupyter.ens.uvsq.fr/c2o2b/token'
oauth_callback_url = 'https://jupyter.ens.uvsq.fr/hub/oauth_callback'

c.JupyterHub.authenticator_class = UVSQAuthenticator
from jhub_cas_authenticator.cas_auth import CASAuthenticator
c.JupyterHub.authenticator_class = CASAuthenticator

# The CAS URLs to redirect (un)authenticated users to.
c.CASAuthenticator.cas_login_url = 'https://cas.uvsq.fr/login'
c.CASLocalAuthenticator.cas_logout_url = 'https://cas.uvsq/logout'

# The CAS endpoint for validating service tickets.
c.CASAuthenticator.cas_service_validate_url = 'https://cas.uvsq.fr/serviceValidate'

# The service URL the CAS server will redirect the browser back to on successful authentication.
c.CASAuthenticator.cas_service_url = 'https://sage.prism.uvsq.fr/hub/login'

c.Authenticator.admin_users = { 'lucadefe' }

Expand Down
41 changes: 0 additions & 41 deletions oauth2/config.js

This file was deleted.

0 comments on commit afb8a91

Please sign in to comment.