mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 00:53:21 +00:00 
			
		
		
		
	GUACAMOLE-736: Replace JAXB DatatypeConverter with Guava BaseEncoding.
This commit is contained in:
		| @@ -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