Insufficient credentials should take precedence over other credentials errors.
@@ -36,6 +36,7 @@ import org.apache.guacamole.net.auth.Credentials;
import org.apache.guacamole.net.auth.UserContext;
import org.apache.guacamole.net.auth.credentials.CredentialsInfo;
import org.apache.guacamole.net.auth.credentials.GuacamoleCredentialsException;
+import org.apache.guacamole.net.auth.credentials.GuacamoleInsufficientCredentialsException;
import org.apache.guacamole.net.auth.credentials.GuacamoleInvalidCredentialsException;
import org.apache.guacamole.net.event.AuthenticationFailureEvent;
import org.apache.guacamole.net.event.AuthenticationSuccessEvent;
@@ -170,7 +171,13 @@ public class AuthenticationService {
return authenticatedUser;
}
- // First failure takes priority for now
+ // Insufficient credentials should take precedence
+ catch (GuacamoleInsufficientCredentialsException e) {
+ if (authFailure == null || authFailure instanceof GuacamoleInvalidCredentialsException)
+ authFailure = e;
+ }
+
+ // Catch other credentials exceptions and assign the first one
catch (GuacamoleCredentialsException e) {
if (authFailure == null)
authFailure = e;
