Uploaded image for project: 'MINA SSHD'
  1. MINA SSHD
  2. SSHD-220

Return a usable AuthFuture when authenticating on the client side

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.8.0
    • 0.9.0
    • None

    Description

      One problem I found when implementing my service path was that ClientSessionImpl.waitFor wants to root around in the internals of UserAuthService to determine if the server is waiting for user authentication.

      This patch is a partial back port of the changes I made to address that problem. Instead of using waitFor(WAIT_AUTH), the authentication code can directly wait on the AuthFuture returned vis:

      AuthFuture authFuture;
      do {
      if (hasKeys)

      { authFuture = session.authAgent(login); }

      else

      { System.out.print("Password:"); BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); String password = r.readLine(); authFuture = session.authPassword(login, password); }

      authFuture.await();
      } while (authFuture.isFailure());
      if (!authFuture.isSuccess())

      { System.err.println("error"); System.exit(-1); }

      looking at the details:

      • it factors out the duplicated code that was handling the wait for the server, and processing server/client messages
      • if the connection fails, that's reported by getException()!=null and everything else being false.
      • the internals also authFuture to wait for the server (just like the above)
      • even makes it possible to delete WAIT_AUTH if so desired

      Attachments

        1. sshd-220.patch
          17 kB
          Andrew C

        Activity

          People

            gnodet Guillaume Nodet
            fixmo-cagney Andrew C
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: