Consolidate our web login and credentials prompt auth logic.
Review Request #14575 — Created Sept. 8, 2025 and updated — Latest diff uploaded
The
get_authenticated_session()andBaseCommand.credentials_prompt()
functions both contain the same code for prompting users for their
username and password in the terminal. These need to be merged so we
don't have to maintain two copies of the same code. The functions aren't
direct replacements for one another though, they have different usages.
So instead we pull out the credentials prompt logic into a
credentials_prompt()function, which the above functions can call.Previously, only
get_authenticated_session()contained the logic for
kicking off web-based login. But we want to enable web-based login for
all rbt commands, not just the ones that callget_authenticated_session().
We now pull out the logic into anattempt_web_login()function that
anything can call when they want to authenticate a client using
web-based login.In the next change we'll make use of this function in a new auth handler
that lets us try web-based login if enabled before falling back on Basic
auth.
- Ran unit tests.
- Tested using all versions of the web login, open browser, and
debug/logging options and their.reviewboardrcconfig values
onrbt login,rbt postandrbt status. - Tested passing a username, a username and password, and an API
token to commands. - Tested passing the same auth credentials above to commands while
also passing --web-login (or setting in in.reviewboardrc), saw
that the auth credentials were used instead. - Tested
rbt post --diff-filename=-with piping a diff into STDIN
while also passing--web-login. Was able to login using web
auth before the rest of the command ran.