• 
      

    Consolidate our web login and credentials prompt auth logic.

    Review Request #14575 — Created Sept. 8, 2025 and submitted — Latest diff uploaded

    Information

    RBTools
    release-5.x

    Reviewers

    The get_authenticated_session() and BaseCommand.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 call get_authenticated_session().
    We now pull out the logic into an attempt_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 .reviewboardrc config values
      on rbt login, rbt post and rbt 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.

    Commits

    Files