Skip to content

Commit

Permalink
switch to github auth
Browse files Browse the repository at this point in the history
  • Loading branch information
mathematicalmichael committed Sep 15, 2022
1 parent 359ad59 commit 6ca065e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
14 changes: 7 additions & 7 deletions jupyterhub_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,19 +202,19 @@ def mount_config_files(self, username='jovyan'):
whitelist.add(name)

# Authenticate users with GitHub OAuth
# c.JupyterHub.authenticator_class = 'oauthenticator.GitHubOAuthenticator'
# c.GitHubOAuthenticator.oauth_callback_url = os.environ['OAUTH_CALLBACK_URL']
c.JupyterHub.authenticator_class = 'oauthenticator.GitHubOAuthenticator'
c.GitHubOAuthenticator.oauth_callback_url = os.environ['OAUTH_CALLBACK_URL']

# Authenticate with thedataincubator/jupyterhub-hashauthenticator
c.JupyterHub.authenticator_class = 'hashauthenticator.HashAuthenticator'
# c.JupyterHub.authenticator_class = 'hashauthenticator.HashAuthenticator'
# You can generate a good "secret key" by running `openssl rand -hex 32` in terminal.
# it is recommended to do this from time-to-time to change passwords (including changing their length)
c.HashAuthenticator.secret_key = os.environ['HASH_SECRET_KEY'] # Defaults to ''
c.HashAuthenticator.password_length = int(os.environ['PASSWORD_LENGTH']) # Defaults to 6
# c.HashAuthenticator.secret_key = os.environ['HASH_SECRET_KEY'] # Defaults to ''
# c.HashAuthenticator.password_length = int(os.environ['PASSWORD_LENGTH']) # Defaults to 6
# Can find your password by looking at `hashauthpw --length 10 [username] [key]`
# If the `show_logins` option is set to `True`, a CSV file containing
#login names and passwords will be served (to admins only) at `/hub/login_list`.
c.HashAuthenticator.show_logins = True # Optional, defaults to False
# login names and passwords will be served (to admins only) at `/hub/login_list`.
# c.HashAuthenticator.show_logins = True # Optional, defaults to False

# TLS config
#c.JupyterHub.port = 8000
Expand Down
3 changes: 3 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ secrets/oauth.env:
@mkdir -p secrets/
@echo "Generating hash key in $@"
@echo "HASH_SECRET_KEY=$(shell openssl rand -hex 32)" > $@
@echo "OAUTH_CLIENT_SECRET=" >> $@
@echo "OAUTH_CLIENT_ID=" >> $@
@echo "OAUTH_CALLBACK_URL=" >> $@

login:
@docker run --rm $(HUB_NAME) hashauthpw --length $(PASSWORD_LENGTH) $(USERNAME) $(HASH_SECRET_KEY)
Expand Down

0 comments on commit 6ca065e

Please sign in to comment.