Skip to content

Commit 1bdca37

Browse files
authored
Polishing (#2418)
1 parent 450599f commit 1bdca37

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

spring-cloud-config-client/src/main/java/org/springframework/cloud/config/client/ConfigClientRequestTemplateFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.io.IOException;
2020
import java.security.GeneralSecurityException;
2121
import java.util.Arrays;
22+
import java.util.Base64;
2223
import java.util.HashMap;
2324
import java.util.Map;
2425
import java.util.concurrent.TimeUnit;
@@ -43,7 +44,6 @@
4344
import org.springframework.http.client.ClientHttpResponse;
4445
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
4546
import org.springframework.http.client.SimpleClientHttpRequestFactory;
46-
import org.springframework.util.Base64Utils;
4747
import org.springframework.web.client.RestTemplate;
4848

4949
import static org.springframework.cloud.config.client.ConfigClientProperties.AUTHORIZATION;
@@ -137,7 +137,7 @@ public void addAuthorizationToken(HttpHeaders httpHeaders, String username, Stri
137137
}
138138

139139
if (password != null) {
140-
byte[] token = Base64Utils.encode((username + ":" + password).getBytes());
140+
byte[] token = Base64.getEncoder().encode((username + ":" + password).getBytes());
141141
httpHeaders.add("Authorization", "Basic " + new String(token));
142142
}
143143
else if (authorization != null) {

spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/encryption/EncryptionController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.io.UnsupportedEncodingException;
2020
import java.net.URLDecoder;
21+
import java.util.Base64;
2122
import java.util.Collections;
2223
import java.util.HashMap;
2324
import java.util.Map;
@@ -33,7 +34,6 @@
3334
import org.springframework.security.crypto.encrypt.TextEncryptor;
3435
import org.springframework.security.rsa.crypto.RsaKeyHolder;
3536
import org.springframework.security.rsa.crypto.RsaSecretEncryptor;
36-
import org.springframework.util.Base64Utils;
3737
import org.springframework.web.bind.annotation.ExceptionHandler;
3838
import org.springframework.web.bind.annotation.GetMapping;
3939
import org.springframework.web.bind.annotation.PathVariable;
@@ -194,7 +194,7 @@ private String stripFormData(String data, MediaType type, boolean cipher) {
194194
}
195195
catch (IllegalArgumentException e) {
196196
try {
197-
Base64Utils.decode(candidate.getBytes());
197+
Base64.getDecoder().decode(candidate.getBytes());
198198
return candidate;
199199
}
200200
catch (IllegalArgumentException ex) {

0 commit comments

Comments
 (0)