GUACAMOLE-362: Deal gracefully with situations where password cannot be decrypted.

This commit is contained in:
Nick Couchman authored and Nick Couchman committed 2017-10-27 13:05:12 -04:00
1 parent 36489ff403
commit ed4c025a2e
2 files changed
+15 -4

No files matched your search

@@ -173,10 +173,15 @@ public class AuthenticationProviderService {
final Cipher cipher = confService.getClearpassCipher();
// Decrypt and return a new string.
final byte[] pass64 = DatatypeConverter.parseBase64Binary(encryptedPassword);
final byte[] cipherData = cipher.doFinal(pass64);
return new String(cipherData);
if (cipher != null) {
// Decode and decrypt, and return a new string.
final byte[] pass64 = DatatypeConverter.parseBase64Binary(encryptedPassword);
final byte[] cipherData = cipher.doFinal(pass64);
return new String(cipherData);
}
}
catch (Throwable t) {
logger.error("Failed to decrypt the data, password token will not be available.");
@@ -184,6 +189,9 @@ public class AuthenticationProviderService {
return null;
}
logger.warn("Encrypted password provided by CAS, but no Private Key was available to decrypt it.");
return null;
}
}