Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] [PAVICS] Logging in via email/password does not provide account name #598

Closed
Zeitsperre opened this issue Jan 16, 2024 · 8 comments · Fixed by bird-house/birdhouse-deploy#421
Assignees
Labels
bug Problem, error, or invalid behaviour ui Something related to the UI operations or display

Comments

@Zeitsperre
Copy link

Zeitsperre commented Jan 16, 2024

Describe the bug

This just happened with a user today.

The user forgot his username and decided to use his email to log in to PAVICS (via JupyterLab). They were authenticated by Magpie, and proceeded to enter their workspace, but the docker image failed to build. Upon inspection, the URL shows that instead of the account name (e.g. jupyter/user/myusername), PAVICS attempted to spawn an instance using their email (e.g. jupyter/user/me@mydomain.ca).

To Reproduce

  1. Logout of instances of Magpie/PAVICS-JupyterLab
  2. Login to PAVICS-JupyterLab using email associated with account and password
  3. Attempt to spin up a docker image of a PAVICS-JupyterLab workspace

Expected behavior
If an email is used to log in, the workspace URL should use the associated account name and not the email. It should also not hang for several minutes, then crash.

Screenshots

thumbnail_image002

Desktop (please complete the following information):

  • OS: Fedora 39
  • Browser: Tested on Firefox
  • Instance: pavics.ouranos.ca
@Zeitsperre Zeitsperre added the bug Problem, error, or invalid behaviour label Jan 16, 2024
Copy link

Thanks for submitting an issue. Make sure you have checked for similar issues. Also, provide enough details for us to be able to replicate the problem.

@Zeitsperre Zeitsperre added the ui Something related to the UI operations or display label Jan 16, 2024
@tlvu
Copy link
Contributor

tlvu commented Jan 16, 2024

@fmigneault is there a config switch in Magpie to disable login using email?

@mishaschwartz
Copy link
Collaborator

This is because jupyterhub uses the value that is provided by the user in the "Username" field to determine the jupyter_hub user name:

https://github.com/Ouranosinc/jupyterhub/blob/4.0.2-20231130/jupyterhub_magpie_authenticator/jupyterhub_magpie_authenticator.py#L88

It is a quirk of Magpie that you can provide an email address in the "user_name" field and it will work with the exact same behaviour.

Note that this has been the case since the introduction of the Magpie Jupyterhub Authenticator:

https://github.com/Ouranosinc/jupyterhub/blob/1.0.0-20200130/jupyterhub_magpie_authenticator/jupyterhub_magpie_authenticator.py#L33

@fmigneault
Copy link
Collaborator

I believe the issue here is more on the JupyterHub login handler than Magpie. It should do a request /magpie/users/current with the obtained login token to retrieve the user name instead of assuming it is the provided value.

@Zeitsperre
Copy link
Author

If this issue should be moved to the JupyterLab repo, feel free to transfer it. This really threw me and the user who was having trouble for a loop this morning.

@mishaschwartz
Copy link
Collaborator

I believe the issue here is more on the JupyterHub login handler than Magpie. It should do a request /magpie/users/current with the obtained login token to retrieve the user name instead of assuming it is the provided value.

Alright, I can work on that

@mishaschwartz
Copy link
Collaborator

@fmigneault

fix in place here: Ouranosinc/jupyterhub#26

(sorry I can't add you as a reviewer)

@tlvu
Copy link
Contributor

tlvu commented Jan 16, 2024

@fmigneault

fix in place here: Ouranosinc/jupyterhub#26

(sorry I can't add you as a reviewer)

fmigneault added as reviewer.

mishaschwartz added a commit to Ouranosinc/jupyterhub that referenced this issue Jan 17, 2024
Fetches the username from magpie instead of assuming that the value in
the username field is a valid username (it can be an email address
instead).

In response to Ouranosinc/Magpie#598
mishaschwartz added a commit to bird-house/birdhouse-deploy that referenced this issue Jan 17, 2024
## Overview

Previously, JupyterHub's `MagpieAuthenticator` class treated the email
address entered into the username field as the username itself. This led
to a mismatch between the username in JupyterHub and the username in
Magpie.

To resolve this, we update the JupyterHub docker image to a version
where this bug is fixed.

See Ouranosinc/jupyterhub#26 and
Ouranosinc/Magpie#598 for reference.

## Changes

**Non-breaking changes**
- Update jupyterhub to version 4.0.2-20240117

**Breaking changes**

## Related Issue / Discussion

- Resolves Ouranosinc/Magpie#598 

## Additional Information

Links to other issues or sources.

<!--
The test suite can be run using a different DACCS config with
``birdhouse_daccs_configs_branch: branch_name`` in the PR description.
To globally skip the test suite regardless of the commit message use
``birdhouse_skip_ci: true`` in the PR description.
-->

birdhouse_daccs_configs_branch: master
birdhouse_skip_ci: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Problem, error, or invalid behaviour ui Something related to the UI operations or display
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants