microbiomedata / nmdc-runtime

Runtime system for NMDC data management and orchestration
https://microbiomedata.github.io/nmdc-runtime/
Other
7 stars 3 forks source link

password reset flow for API user #778

Open dwinston opened 2 days ago

dwinston commented 2 days ago

The Pain

Currently, API users without administrative privileges cannot change/reset/update their passwords (for use in password-based auth). For an administrator to reset a user's password, they currently

  1. create a new temporary user, issue a direct database command to set the value of the requesting user's hashed password to that of the temporary user, and delete the temporary user (as @eecavanna reported doing in https://github.com/microbiomedata/nmdc-runtime/issues/311#issuecomment-1936729900), or
  2. delete and recreate the user with the same username, etc.

The Dream

As an API user, instead of asking an admin to manually provide me with a new password, I want to reset my password through email/orcid verification by myself so that I have a new password to use (and securely save) within a few minutes.

The Fix (i.e., Acceptance Criteria)

Alternatives Status quo. <joke>How often do users lose their passwords, anyway?</joke>

Additional context Private communication with @shreddd via NMDC Slack raising this issue.

shreddd commented 2 days ago

@dwinston - I think we could do something much simpler, and simply allow the admin an endpoint to update the user. I am prototyping an implementation for this.

shreddd commented 2 days ago

OK - I made a branch that implements an update_user endpoint:

See: https://github.com/microbiomedata/nmdc-runtime/compare/main...update_password

Couple of side notes