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

This commit is contained in:
Nick Couchman
2017-08-27 20:55:27 -04:00
committed by Nick Couchman
parent 36489ff403
commit ed4c025a2e
2 changed files with 15 additions and 4 deletions

View File

@@ -173,10 +173,15 @@ public class AuthenticationProviderService {
final Cipher cipher = confService.getClearpassCipher();
// Decrypt and return a new string.
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;
}
}

View File

@@ -47,6 +47,9 @@ public abstract class CipherGuacamoleProperty implements GuacamoleProperty<Ciphe
@Override
public Cipher parseValue(String value) throws GuacamoleException {
if (value == null || value.isEmpty())
return null;
try {
final Environment environment = new LocalEnvironment();