Replace Base64Utils with JDK's Base64

See gh-33967
This commit is contained in:
Johnny Lim
2023-01-25 01:44:46 +09:00
committed by Moritz Halbritter
parent b62b88372f
commit bc7fc90550
23 changed files with 73 additions and 67 deletions

View File

@@ -18,13 +18,13 @@ package org.springframework.boot.buildpack.platform.docker.configuration;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import org.json.JSONException;
import org.junit.jupiter.api.Test;
import org.skyscreamer.jsonassert.JSONAssert;
import org.springframework.boot.buildpack.platform.json.AbstractJsonTests;
import org.springframework.util.Base64Utils;
import org.springframework.util.StreamUtils;
/**
@@ -39,7 +39,7 @@ class DockerRegistryTokenAuthenticationTests extends AbstractJsonTests {
DockerRegistryTokenAuthentication auth = new DockerRegistryTokenAuthentication("tokenvalue");
String header = auth.getAuthHeader();
String expectedJson = StreamUtils.copyToString(getContent("auth-token.json"), StandardCharsets.UTF_8);
JSONAssert.assertEquals(expectedJson, new String(Base64Utils.decodeFromUrlSafeString(header)), false);
JSONAssert.assertEquals(expectedJson, new String(Base64.getUrlDecoder().decode(header)), false);
}
}

View File

@@ -18,13 +18,13 @@ package org.springframework.boot.buildpack.platform.docker.configuration;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import org.json.JSONException;
import org.junit.jupiter.api.Test;
import org.skyscreamer.jsonassert.JSONAssert;
import org.springframework.boot.buildpack.platform.json.AbstractJsonTests;
import org.springframework.util.Base64Utils;
import org.springframework.util.StreamUtils;
/**
@@ -52,7 +52,7 @@ class DockerRegistryUserAuthenticationTests extends AbstractJsonTests {
}
private String decoded(String header) {
return new String(Base64Utils.decodeFromUrlSafeString(header));
return new String(Base64.getUrlDecoder().decode(header));
}
}