Passwordless test login - #2062
davidwaroquiers wants to merge 7 commits into
Conversation
|
@jbouquiaux could you test and review (probably more the backend part) this ? Likely we can add something in the dev-docker documentation with the command to add a user with the docker compose (something like "docker compose exec api-dev uv run invoke dev.create-test-user --username gloubs --role user") |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2062 +/- ##
==========================================
+ Coverage 81.47% 81.56% +0.08%
==========================================
Files 88 88
Lines 8465 8509 +44
==========================================
+ Hits 6897 6940 +43
- Misses 1568 1569 +1
🚀 New features to boost your workflow:
|
ml-evs
left a comment
There was a problem hiding this comment.
Hi @davidwaroquiers, thanks for this. We definitely need something that solves this problem but I think I've come down against the idea of adding password-based login in this way.
I think my suggestion would be instead to hook into the email login approach and enable that by default on dev servers. We can then make invoke dev.serve provide an authenticated link with a token for testing the developers "normal" user by default, and an extra invoke task very similar to the one you added here that creates a test-user and prints a token link for the developer.
What do you think? Happy to implement this if you are okay with it, or go back to this idea if you still prefer a password.
Hi @ml-evs Thank you for the message. Just to mention that it is even not with a password it's "easier". Here is with a few screenshots: 1/ Login page:
2/ List of clickable passwordless users with some info (their role, the group(s) they belong to):
And you just click on the user you want to be logged in. That eases tests with different users with different roles, belonging to different groups, in the future it could also help test group admins, project admins etc ...). It is quite perpendicular to almost everything in datalab. It only touches four small points:
After a user is selected, everything follows the normal datalab "flow path" (using the Flask login session for access etc ...). What do you think ? |
fake email identity.
|
Ah sorry, I think I just searched for "password" and thought I was responding to #1898 🙃 I guess my question then becomes whether adding this to the UI itself is that useful, and if it really needs an API route? I'd prefer a task that lists these login users in the terminal and offers login links for each. Do you find the extra UI component that much more useful than having e.g., a few private browser windows logged in as different accounts? |
Not that much more useful indeed. I think the idea of having one invoke task that gives the list of passwordless users and their "properties" (roles, groups, ...) and the link is all good. I'll remove the UI part. As for the API route, we at least need the one to login no ? |


Added an additional login procedure for dev/tests. This is purposedly simplistic, just a username, and to login, you just click on the user in the list. The goal is to be able to test various access features / groups etc ... without the need to have multiple OAuth logins.
Adapted from the previous PR here: Matgenix#5
In this previous PR, a password credentials existed. Given the actual purpose of this, i.e. just be able to have different authenticated users easily in a purely test/dev environments, the password credentials added unnecessary code.
Logic in datalab for access to items/anything is:
1/ Authentication (who am I)
2/ Tenant access (do i have access to to this datalab instance)
3/ resource-level access control (can I access this specific "object")
This PR allow to kind of "bypass" 1/ and 2/ (not really bypass, just make it super easy for testing/development).