From c3aaf0aa032713e70c72326e19e3733db8f7670f Mon Sep 17 00:00:00 2001 From: Nick Couchman Date: Wed, 23 Aug 2017 10:27:09 -0400 Subject: [PATCH] GUACAMOLE-362: Debug should throw full exception, not just getMessage() output. --- .../auth/cas/AuthenticationProviderService.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/extensions/guacamole-auth-cas/src/main/java/org/apache/guacamole/auth/cas/AuthenticationProviderService.java b/extensions/guacamole-auth-cas/src/main/java/org/apache/guacamole/auth/cas/AuthenticationProviderService.java index 17970600b..feb842dd2 100644 --- a/extensions/guacamole-auth-cas/src/main/java/org/apache/guacamole/auth/cas/AuthenticationProviderService.java +++ b/extensions/guacamole-auth-cas/src/main/java/org/apache/guacamole/auth/cas/AuthenticationProviderService.java @@ -27,6 +27,7 @@ import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import java.io.IOException; +import java.lang.IllegalArgumentException; import java.security.InvalidKeyException; import java.security.KeyFactory; import java.security.NoSuchAlgorithmException; @@ -190,27 +191,32 @@ public class AuthenticationProviderService { } catch (FileNotFoundException e) { logger.error("ClearPass key file not found, password will not be decrypted."); - logger.debug("Error locating the ClearPass key file: {}", e.getMessage()); + logger.debug("Error locating the ClearPass key file: {}", e); return null; } catch (IOException e) { logger.error("Error reading ClearPass key file, password will not be decrypted."); - logger.debug("Error reading the ClearPass key file: {}", e.getMessage()); + logger.debug("Error reading the ClearPass key file: {}", e); return null; } catch (NoSuchAlgorithmException e) { logger.error("Unable to find the specified algorithm, password will not be decrypted."); - logger.debug("Algorithm was not found: {}", e.getMessage()); + logger.debug("Algorithm was not found: {}", e); return null; } catch (InvalidKeyException e) { logger.error("Invalid key was loaded, password will not be decrypted."); - logger.debug("The loaded key was invalid: {}", e.getMessage()); + logger.debug("The loaded key was invalid: {}", e); + return null; + } + catch (IllegalArgumentException e) { + logger.error("Failed to parse Base64 data, password will not be decrypted."); + logger.debug("Data received was not valid Base64 data, so decryption cannot continue: {}", e); return null; } catch (Throwable t) { logger.error("Error decrypting password, it will not be available as a token."); - logger.debug("Error in one of the components to decrypt the password: {}", t.getMessage()); + logger.debug("Error in one of the components to decrypt the password: {}", t); return null; }