Configure Asgardeo as JupyterHub authenticator

Wathsara Wishwantha Daluwatta
3 min readOct 31, 2021

What is Asgardeo?

Asgardeo is latest IDaaS introduced by WSO2 enabling developers with little IAM experience to create seamless login experiences in minutes. Currently Asgardeo is live for Early Adoption which I’m inviting you all to start your journey with next generation IDaaS today for free. With this blog I will focus on to configuring Asgardeo as JupyterHub authenticator.

What is JupyterHub?

You all might have heard about Jupyter Notebook which is a server-client application that allows editing and running notebook documents via a web browser. JupyterHub is an extended version which brings the power of notebooks to groups of users.

Prerequisites

  1. Sign up to Asgardeo.
  2. Install JupyterHub

First you need to register an OpenID application in Asgardeo.

  1. Login to Asgardeo Console.
  2. Go to Develop section and then select Applications.
  3. Click New Application.
  4. Choose Traditional Web Application and Choose OpenID Connect.
  5. Provide any application name and configure http://localhost:8000/hub/oauth_callback as the Authorized redirect URLs and click Register

6. Then go to the User Attribute tab > First Name and update the application. Then OpenID Connect Scopes > OpenID > New Attribute and add First Name.

7. Then go to Protocol tab and obtain a Client ID and Client Secret.

8. As the Final step, go to info tab to obtain all the sever endpoints which we will be using in next steps.

Now you need to create a customer user in Asgardeo.

  1. Go to Manage section and then select Users.
  2. Click New User and select Customer.
  3. Enter the customer Email, First Name, Last Name and select Set a temporary password for user and enter a password and then click Finish.

Now it’s time to start configure JupyterHub.

  1. JupyterHub will look by default for a configuration file, in the current working directory by default. Therefor to generate the run jupyterhub — generate-config
  2. Install the oauthenticator package using the pip install oauthenticator
  3. Then Inset the following python to the generated jupyter_notebook_config.py by replacing the values you obtained from the Asgardeo.

4. Now start the JupyterHub pointing out the configuration file we just created by using jupyterhub -f /path/to/jupyterhub_config.py command.

5 . This step is only for the users that are not having a Linux OS as their OS. What you need to do is create a user by giving the same first name you have used to create the customer user in Asgardeo.

Mac — https://support.apple.com/en-lk/guide/mac-help/mtusr001/mac
Windows — https://www.windows-commandline.com/add-user-from-command-line/

It’s time for the demonstration.

Great…!!

Here you have configure the Asgardeo as the authenticator of JupyterHub. Now you could follow https://wso2.com/asgardeo/docs and customize the logins as you wish within minutes.

And also you can follow https://github.com/jupyterhub/oauthenticator and bring your authorization to the JupyterHub. Hopefully I will come up with an separate article on how to do it using the Asgardeo.

Reference

https://wso2.com/asgardeo/docs

--

--

Wathsara Wishwantha Daluwatta

Software Engineer at WSO2 | Studied BSc (Hons) Software Engineering at University of Colombo School of Computing