@@ -40,7 +40,7 @@ public class UserAuthImpl
4040        extends  AbstractService 
4141        implements  UserAuth  {
4242
43-     private  final  Promise <Boolean , UserAuthException > authenticated ;
43+     private  final  Promise <AuthResult , UserAuthException > authenticated ;
4444
4545    // Externally available 
4646    private  volatile  String  banner  = "" ;
@@ -53,13 +53,13 @@ public class UserAuthImpl
5353
5454    public  UserAuthImpl (Transport  trans ) {
5555        super ("ssh-userauth" , trans );
56-         authenticated  = new  Promise <Boolean , UserAuthException >("authenticated" , UserAuthException .chainer , trans .getConfig ().getLoggerFactory ());
56+         authenticated  = new  Promise <AuthResult , UserAuthException >("authenticated" , UserAuthException .chainer , trans .getConfig ().getLoggerFactory ());
5757    }
5858
5959    @ Override 
60-     public  boolean  authenticate (String  username , Service  nextService , AuthMethod  method , int  timeoutMs )
60+     public  AuthResult  authenticate (String  username , Service  nextService , AuthMethod  method , int  timeoutMs )
6161            throws  UserAuthException , TransportException  {
62-         final  boolean  outcome ;
62+         final  AuthResult  outcome ;
6363
6464        authenticated .lock ();
6565        try  {
@@ -73,8 +73,10 @@ public boolean authenticate(String username, Service nextService, AuthMethod met
7373            currentMethod .request ();
7474            outcome  = authenticated .retrieve (timeoutMs , TimeUnit .MILLISECONDS );
7575
76-             if  (outcome ) {
76+             if  (outcome  ==  AuthResult . SUCCESS ) {
7777                log .debug ("`{}` auth successful" , method .getName ());
78+             }  else  if  (outcome  == AuthResult .PARTIAL ) {
79+                 log .debug ("`{}` auth partially successful" , method .getName ());
7880            } else  {
7981                log .debug ("`{}` auth failed" , method .getName ());
8082            }
@@ -124,7 +126,7 @@ public void handle(Message msg, SSHPacket buf)
124126                    // Should fix https://github.com/hierynomus/sshj/issues/237 
125127                    trans .setAuthenticated (); // So it can put delayed compression into force if applicable 
126128                    trans .setService (nextService ); // We aren't in charge anymore, next service is 
127-                     authenticated .deliver (true );
129+                     authenticated .deliver (AuthResult . SUCCESS );
128130                    break ;
129131
130132                case  USERAUTH_FAILURE :
@@ -133,7 +135,7 @@ public void handle(Message msg, SSHPacket buf)
133135                    if  (allowedMethods .contains (currentMethod .getName ()) && currentMethod .shouldRetry ()) {
134136                        currentMethod .request ();
135137                    } else  {
136-                         authenticated .deliver (false );
138+                         authenticated .deliver (partialSuccess  ?  AuthResult . PARTIAL  :  AuthResult . FAILURE );
137139                    }
138140                    break ;
139141
0 commit comments