diff --git a/src/main/java/com/github/dockerjava/core/exec/AbstrDockerCmdExec.java b/src/main/java/com/github/dockerjava/core/exec/AbstrDockerCmdExec.java index 25f6c1f5d..1ec333416 100644 --- a/src/main/java/com/github/dockerjava/core/exec/AbstrDockerCmdExec.java +++ b/src/main/java/com/github/dockerjava/core/exec/AbstrDockerCmdExec.java @@ -8,7 +8,7 @@ import com.github.dockerjava.core.InvocationBuilder; import com.github.dockerjava.core.RemoteApiVersion; import com.github.dockerjava.core.WebTarget; -import org.apache.commons.codec.binary.Base64; +import com.google.common.io.BaseEncoding; import javax.annotation.CheckForNull; import javax.annotation.Nonnull; @@ -42,7 +42,7 @@ protected AuthConfigurations getBuildAuthConfigs() { protected String registryAuth(@Nonnull AuthConfig authConfig) { try { - return Base64.encodeBase64String(new ObjectMapper().writeValueAsString(authConfig).getBytes()); + return BaseEncoding.base64Url().encode(new ObjectMapper().writeValueAsString(authConfig).getBytes()); } catch (IOException e) { throw new RuntimeException(e); } @@ -65,8 +65,7 @@ protected String registryConfigs(@Nonnull AuthConfigurations authConfigs) { } else { json = objectMapper.writeValueAsString(authConfigs); } - - return Base64.encodeBase64String(json.getBytes()); + return BaseEncoding.base64Url().encode(json.getBytes()); } catch (IOException e) { throw new RuntimeException(e); } diff --git a/src/main/java/com/github/dockerjava/jaxrs/AbstrDockerCmdExec.java b/src/main/java/com/github/dockerjava/jaxrs/AbstrDockerCmdExec.java index e5852f5ea..47681e20c 100644 --- a/src/main/java/com/github/dockerjava/jaxrs/AbstrDockerCmdExec.java +++ b/src/main/java/com/github/dockerjava/jaxrs/AbstrDockerCmdExec.java @@ -6,7 +6,7 @@ import com.github.dockerjava.api.model.AuthConfigurations; import com.github.dockerjava.core.DockerClientConfig; import com.github.dockerjava.core.RemoteApiVersion; -import org.apache.commons.codec.binary.Base64; +import com.google.common.io.BaseEncoding; import javax.ws.rs.client.Invocation; import javax.ws.rs.client.WebTarget; @@ -39,7 +39,7 @@ protected AuthConfigurations getBuildAuthConfigs() { protected String registryAuth(AuthConfig authConfig) { try { - return Base64.encodeBase64String(new ObjectMapper().writeValueAsString(authConfig).getBytes()); + return BaseEncoding.base64Url().encode(new ObjectMapper().writeValueAsString(authConfig).getBytes()); } catch (IOException e) { throw new RuntimeException(e); } @@ -74,7 +74,7 @@ protected String registryConfigs(AuthConfigurations authConfigs) { json = objectMapper.writeValueAsString(authConfigs); } - return Base64.encodeBase64String(json.getBytes()); + return BaseEncoding.base64Url().encode(json.getBytes()); } catch (IOException e) { throw new RuntimeException(e); }