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

Use the JupyterHub User with UserInfo on NativeAuthenticator #28

Open
leportella opened this issue Jan 11, 2019 · 2 comments
Open

Use the JupyterHub User with UserInfo on NativeAuthenticator #28

leportella opened this issue Jan 11, 2019 · 2 comments
Labels
question Further information is requested

Comments

@leportella
Copy link
Collaborator

As exposed by @minrk on issue #26 it is not the best approach to use the JupyterHub orm on NativeAuth. However, to use the /admin endpoint for user management, it would be necessary to connect information between users. At least I think so. What's you thoughts on this? @minrk @yuvipanda

@leportella leportella added the question Further information is requested label Jan 11, 2019
@yuvipanda
Copy link
Contributor

Hmm, the reasons I wanted to use the same ORM setup are:

  1. To prevent having to keep multiple databases in sync (especially around user cascading deletes, and recreating users with the same name)
  2. To prevent admins from having to set up different databases - re-using has similar api stability problems because we don't support prefixes on the JupyterHub side (afaik). This is not as big a deal though.

I used a separate db for FirstUseAuthenticator, and ran into a score of issues related to (1) - especially around propagating user deletions. I also see what @minrk is suggesting about medium-longer term API compatibility.

@minrk do we have some way to propagate user deletes across? I think with that we should be ok.

@leportella for the endpoint, I think we need to call it something like /nativeauth/admin or some such - or more specifically, multiple ones (/nativeauth/authorize-accounts, /nativeauth/reset-password, etc).

@minrk
Copy link
Member

minrk commented Jan 14, 2019

It's not an urgent issue (it will only come up on possible hub upgrades), so I wouldn't worry about it too much to start. But it is raising my "private api" flag. Using e.g. the db_url config to talk to the same database does seem like a sensible solution to avoid maintaining multiple databases, but I am reticent to recommend 'relations' on the existing tables and especially the ORM API, since I want to, among other things, reserve the right to move away from sqlalchemy when we are looking at high-availability hubs.

I think the only answer we currently have for authenticators storing state related to users is the auth_state field. This is covered by the deletion, etc., but I think there isn't a good answer to retrieving this data during the authenticate process.

As for deletion cascades, I would think the existing Authenticator.delete_user hook would suffice. What cases are there where this doesn't work?

Maybe we can take this opportunity to enumerate some of the things that Authenticators with external state may need, and codify them at the Python level. That's how we got auth_state, and it sounds like there's more that we can add. I'd love to get to a point where Authenticators and Spawners don't even have direct access to the database connection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants