mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUACAMOLE-736: Replace JAXB DatatypeConverter with Guava BaseEncoding.
This commit is contained in:
@@ -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>
|
||||
|
@@ -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"));
|
||||
|
||||
|
@@ -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();
|
||||
|
||||
}
|
||||
|
||||
|
@@ -98,13 +98,6 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Java XML -->
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Guacamole Extension API -->
|
||||
<dependency>
|
||||
<groupId>org.apache.guacamole</groupId>
|
||||
@@ -142,7 +135,7 @@
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>19.0</version>
|
||||
<version>27.0.1-jre</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
@@ -19,10 +19,10 @@
|
||||
|
||||
package org.apache.guacamole.auth.jdbc.security;
|
||||
|
||||
import com.google.common.io.BaseEncoding;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
|
||||
/**
|
||||
* Provides a SHA-256 based implementation of the password encryption
|
||||
@@ -40,7 +40,7 @@ public class SHA256PasswordEncryptionService implements PasswordEncryptionServic
|
||||
builder.append(password);
|
||||
|
||||
if (salt != null)
|
||||
builder.append(DatatypeConverter.printHexBinary(salt));
|
||||
builder.append(BaseEncoding.base16().encode(salt));
|
||||
|
||||
// Hash UTF-8 bytes of possibly-salted password
|
||||
MessageDigest md = MessageDigest.getInstance("SHA-256");
|
||||
|
@@ -189,6 +189,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>
|
||||
@@ -210,13 +217,6 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Java XML -->
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- JRadius Core Library -->
|
||||
<dependency>
|
||||
<groupId>net.jradius</groupId>
|
||||
|
@@ -19,13 +19,11 @@
|
||||
|
||||
package org.apache.guacamole.auth.radius;
|
||||
|
||||
import com.google.common.io.BaseEncoding;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
import java.lang.IllegalArgumentException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Arrays;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
import org.apache.guacamole.auth.radius.user.AuthenticatedUser;
|
||||
import org.apache.guacamole.auth.radius.form.RadiusChallengeResponseField;
|
||||
import org.apache.guacamole.auth.radius.form.RadiusStateField;
|
||||
@@ -100,7 +98,7 @@ public class AuthenticationProviderService {
|
||||
|
||||
// We have the required attributes - convert to strings and then generate the additional login box/field
|
||||
String replyMsg = replyAttr.toString();
|
||||
String radiusState = DatatypeConverter.printHexBinary(stateAttr.getValue().getBytes());
|
||||
String radiusState = BaseEncoding.base16().encode(stateAttr.getValue().getBytes());
|
||||
Field radiusResponseField = new RadiusChallengeResponseField(replyMsg);
|
||||
Field radiusStateField = new RadiusStateField(radiusState);
|
||||
|
||||
@@ -164,7 +162,7 @@ public class AuthenticationProviderService {
|
||||
throw new GuacamoleInvalidCredentialsException("Authentication error.", CredentialsInfo.USERNAME_PASSWORD);
|
||||
}
|
||||
|
||||
byte[] stateBytes = DatatypeConverter.parseHexBinary(stateString);
|
||||
byte[] stateBytes = BaseEncoding.base16().decode(stateString);
|
||||
radPack = radiusService.sendChallengeResponse(credentials.getUsername(),
|
||||
challengeResponse,
|
||||
stateBytes);
|
||||
|
@@ -220,6 +220,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>
|
||||
@@ -241,20 +248,6 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Java XML -->
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Guava - Utility Library -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>18.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- JUnit -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
|
@@ -30,7 +30,6 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import javax.ws.rs.core.UriBuilder;
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
import org.apache.guacamole.GuacamoleException;
|
||||
import org.apache.guacamole.auth.totp.user.UserTOTPKey;
|
||||
import org.apache.guacamole.auth.totp.conf.ConfigurationService;
|
||||
@@ -309,7 +308,7 @@ public class AuthenticationCodeField extends Field {
|
||||
|
||||
// Return data URI for generated image
|
||||
return "data:image/png;base64,"
|
||||
+ DatatypeConverter.printBase64Binary(stream.toByteArray());
|
||||
+ BaseEncoding.base64().encode(stream.toByteArray());
|
||||
|
||||
}
|
||||
|
||||
|
@@ -493,6 +493,13 @@
|
||||
</exclusions>
|
||||
|
||||
</dependency>
|
||||
|
||||
<!-- Guava Base Libraries -->
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>27.0.1-jre</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
@@ -19,8 +19,8 @@
|
||||
|
||||
package org.apache.guacamole.rest.auth;
|
||||
|
||||
import com.google.common.io.BaseEncoding;
|
||||
import java.security.SecureRandom;
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
|
||||
/**
|
||||
* An implementation of the AuthTokenGenerator based around SecureRandom.
|
||||
@@ -37,7 +37,7 @@ public class SecureRandomAuthTokenGenerator implements AuthTokenGenerator {
|
||||
byte[] bytes = new byte[32];
|
||||
secureRandom.nextBytes(bytes);
|
||||
|
||||
return DatatypeConverter.printHexBinary(bytes);
|
||||
return BaseEncoding.base16().encode(bytes);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -19,6 +19,7 @@
|
||||
|
||||
package org.apache.guacamole.rest.auth;
|
||||
|
||||
import com.google.common.io.BaseEncoding;
|
||||
import com.google.inject.Inject;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
@@ -33,7 +34,6 @@ import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.MultivaluedMap;
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
import org.apache.guacamole.GuacamoleException;
|
||||
import org.apache.guacamole.GuacamoleResourceNotFoundException;
|
||||
import org.apache.guacamole.net.auth.AuthenticatedUser;
|
||||
@@ -94,7 +94,8 @@ public class TokenRESTService {
|
||||
|
||||
// Decode base64 authorization
|
||||
String basicBase64 = authorization.substring(6);
|
||||
String basicCredentials = new String(DatatypeConverter.parseBase64Binary(basicBase64), "UTF-8");
|
||||
String basicCredentials = new String(
|
||||
BaseEncoding.base64().decode(basicBase64), "UTF-8");
|
||||
|
||||
// Pull username/password from auth data
|
||||
int colon = basicCredentials.indexOf(':');
|
||||
|
@@ -19,11 +19,11 @@
|
||||
|
||||
package org.apache.guacamole.tunnel;
|
||||
|
||||
import com.google.common.io.BaseEncoding;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
import org.apache.guacamole.GuacamoleException;
|
||||
import org.apache.guacamole.net.GuacamoleTunnel;
|
||||
import org.apache.guacamole.protocol.GuacamoleInstruction;
|
||||
@@ -75,7 +75,7 @@ public class InputStreamInterceptingFilter
|
||||
|
||||
// Send "blob" containing provided data
|
||||
sendInstruction(new GuacamoleInstruction("blob", index,
|
||||
DatatypeConverter.printBase64Binary(blob)));
|
||||
BaseEncoding.base64().encode(blob)));
|
||||
|
||||
}
|
||||
|
||||
|
@@ -19,10 +19,10 @@
|
||||
|
||||
package org.apache.guacamole.tunnel;
|
||||
|
||||
import com.google.common.io.BaseEncoding;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.List;
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
import org.apache.guacamole.GuacamoleException;
|
||||
import org.apache.guacamole.net.GuacamoleTunnel;
|
||||
import org.apache.guacamole.protocol.GuacamoleInstruction;
|
||||
@@ -127,7 +127,7 @@ public class OutputStreamInterceptingFilter
|
||||
byte[] blob;
|
||||
try {
|
||||
String data = args.get(1);
|
||||
blob = DatatypeConverter.parseBase64Binary(data);
|
||||
blob = BaseEncoding.base64().decode(data);
|
||||
}
|
||||
catch (IllegalArgumentException e) {
|
||||
logger.warn("Received base64 data for intercepted stream was invalid.");
|
||||
|
Reference in New Issue
Block a user