You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Guillaume Nodet (JIRA)" <ji...@apache.org> on 2013/07/19 08:34:49 UTC
[jira] [Resolved] (SSHD-220) Return a usable AuthFuture when
authenticating on the client side
[ https://issues.apache.org/jira/browse/SSHD-220?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Guillaume Nodet resolved SSHD-220.
----------------------------------
Resolution: Fixed
> Return a usable AuthFuture when authenticating on the client side
> -----------------------------------------------------------------
>
> Key: SSHD-220
> URL: https://issues.apache.org/jira/browse/SSHD-220
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 0.8.0
> Reporter: Andrew C
> Assignee: Guillaume Nodet
> Fix For: 0.9.0
>
> Attachments: sshd-220.patch
>
>
> 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
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira