mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-736: Replace JAXB DatatypeConverter with Guava BaseEncoding.
This commit is contained in:
@@ -216,6 +216,13 @@
|
||||
<version>1.1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Guava - Utility Library -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>27.0.1-jre</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Guice -->
|
||||
<dependency>
|
||||
@@ -237,13 +244,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>
|
||||
|
@@ -19,10 +19,10 @@
|
||||
|
||||
package org.apache.guacamole.auth.duo.api;
|
||||
|
||||
import com.google.common.io.BaseEncoding;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
import org.apache.guacamole.GuacamoleClientException;
|
||||
import org.apache.guacamole.GuacamoleException;
|
||||
|
||||
@@ -171,7 +171,7 @@ public class DuoCookie {
|
||||
// Attempt to decode data as base64
|
||||
String data;
|
||||
try {
|
||||
data = new String(DatatypeConverter.parseBase64Binary(str), "UTF-8");
|
||||
data = new String(BaseEncoding.base64().decode(str), "UTF-8");
|
||||
}
|
||||
|
||||
// Bail if invalid base64 is provided
|
||||
@@ -231,7 +231,7 @@ public class DuoCookie {
|
||||
String data = username + "|" + integrationKey + "|" + expires;
|
||||
|
||||
// Encode resulting cookie string with base64
|
||||
return DatatypeConverter.printBase64Binary(data.getBytes("UTF-8"));
|
||||
return BaseEncoding.base64().encode(data.getBytes("UTF-8"));
|
||||
|
||||
}
|
||||
|
||||
|
@@ -19,6 +19,7 @@
|
||||
|
||||
package org.apache.guacamole.auth.duo.api;
|
||||
|
||||
import com.google.common.io.BaseEncoding;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
@@ -26,7 +27,6 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
import org.apache.guacamole.GuacamoleClientException;
|
||||
import org.apache.guacamole.GuacamoleException;
|
||||
import org.apache.guacamole.GuacamoleServerException;
|
||||
@@ -221,7 +221,7 @@ public class SignedDuoCookie extends DuoCookie {
|
||||
mac.init(new SecretKeySpec(key.getBytes("UTF-8"), SIGNATURE_ALGORITHM));
|
||||
|
||||
// Return signature as hex
|
||||
return DatatypeConverter.printHexBinary(mac.doFinal(data.getBytes("UTF-8"))).toLowerCase();
|
||||
return BaseEncoding.base16().encode(mac.doFinal(data.getBytes("UTF-8"))).toLowerCase();
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user