GUACAMOLE-736: Replace JAXB DatatypeConverter with Guava BaseEncoding.

This commit is contained in:
Virtually Nick
2019-02-21 17:09:44 -05:00
parent 87aa2e6c34
commit 37f1da9f1f
16 changed files with 58 additions and 67 deletions

View File

@@ -234,6 +234,13 @@
</exclusion>
</exclusions>
</dependency>
<!-- Guava - Utility Library -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>27.0.1-jre</version>
</dependency>
<!-- Guice -->
<dependency>
@@ -255,13 +262,6 @@
<scope>provided</scope>
</dependency>
<!-- Java XML -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
</dependencies>
</project>

View File

@@ -19,6 +19,7 @@
package org.apache.guacamole.auth.cas.ticket;
import com.google.common.io.BaseEncoding;
import com.google.inject.Inject;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
@@ -28,7 +29,6 @@ import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import java.nio.charset.Charset;
import javax.xml.bind.DatatypeConverter;
import org.apache.guacamole.GuacamoleException;
import org.apache.guacamole.GuacamoleServerException;
import org.apache.guacamole.auth.cas.conf.ConfigurationService;
@@ -161,7 +161,7 @@ public class TicketValidationService {
cipher.init(Cipher.DECRYPT_MODE, clearpassKey);
// Decode and decrypt, and return a new string.
final byte[] pass64 = DatatypeConverter.parseBase64Binary(encryptedPassword);
final byte[] pass64 = BaseEncoding.base64().decode(encryptedPassword);
final byte[] cipherData = cipher.doFinal(pass64);
return new String(cipherData, Charset.forName("UTF-8"));