refactor(common) Use JRE Base64 encoding for BASIC.
MODIFY
common/util/src/main/java/io/apiman/common/util/Basic.java
common/util/src/main/java/io/apiman/common/util/Basic.java
*/
package io.apiman.common.util;
-import org.apache.commons.codec.binary.Base64;
+import java.util.Base64;
+
import org.apache.commons.lang3.StringUtils;
@SuppressWarnings("nls")
@@ -24,12 +25,11 @@ public class Basic {
private Basic() {
}
-
public static String encode(String username, String password) {
String up = username + ':' + password;
StringBuilder builder = new StringBuilder();
builder.append("Basic ");
- builder.append(Base64.encodeBase64String(up.getBytes()));
+ builder.append(Base64.getEncoder().encodeToString(up.getBytes()));
return builder.toString();
}
@@ -47,7 +47,7 @@ public class Basic {
}
public static String[] decode(String input) {
- String decoded = new String(java.util.Base64.getDecoder().decode(input));
+ String decoded = new String(Base64.getDecoder().decode(input));
return StringUtils.split(decoded, ":");
}

refactor(common) Use JRE Base64 encoding for BASIC.