mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUACAMOLE-362: Deal gracefully with situations where password cannot be decrypted.
This commit is contained in:
committed by
Nick Couchman
parent
36489ff403
commit
ed4c025a2e
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -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();
|
||||
|
Reference in New Issue
Block a user