Skip to content

armgit / floci

Public Imported from GitHub
0

Light, fluffy, and always free - The AWS Local Emulator alternative

refactor(core): decode base64url text through Base64Url (#6457)

Kenshin Okinakaeb99ea6655d7
diff --git a/src/main/java/io/github/hectorvent/floci/core/common/Base64Url.java b/src/main/java/io/github/hectorvent/floci/core/common/Base64Url.java
index baee01423b..82d7dde344 100644
--- a/src/main/java/io/github/hectorvent/floci/core/common/Base64Url.java
+++ b/src/main/java/io/github/hectorvent/floci/core/common/Base64Url.java
@@ -17,4 +17,13 @@ public final class Base64Url {
public static String encode(String text) {
return encode(text.getBytes(StandardCharsets.UTF_8));
}
+
+ /**
+ * Decodes {@code text}, padded or not, as UTF-8.
+ *
+ * @throws IllegalArgumentException if {@code text} is not base64url
+ */
+ public static String decode(String text) {
+ return new String(Base64.getUrlDecoder().decode(text), StandardCharsets.UTF_8);
+ }
}
diff --git a/src/main/java/io/github/hectorvent/floci/core/common/Pagination.java b/src/main/java/io/github/hectorvent/floci/core/common/Pagination.java
index a9fea3d89c..9f42d4918a 100644
--- a/src/main/java/io/github/hectorvent/floci/core/common/Pagination.java
+++ b/src/main/java/io/github/hectorvent/floci/core/common/Pagination.java
@@ -1,7 +1,5 @@
package io.github.hectorvent.floci.core.common;
-import java.nio.charset.StandardCharsets;
-import java.util.Base64;
import java.util.Comparator;
import java.util.List;
import java.util.function.Function;
@@ -142,7 +140,7 @@ public final class Pagination {
return null;
}
try {
- return new String(Base64.getUrlDecoder().decode(token), StandardCharsets.UTF_8);
+ return Base64Url.decode(token);
} catch (IllegalArgumentException e) {
return null;
}
diff --git a/src/main/java/io/github/hectorvent/floci/core/common/SignedMarkers.java b/src/main/java/io/github/hectorvent/floci/core/common/SignedMarkers.java
index d95fc8cc61..31e5bd55a4 100644
--- a/src/main/java/io/github/hectorvent/floci/core/common/SignedMarkers.java
+++ b/src/main/java/io/github/hectorvent/floci/core/common/SignedMarkers.java
@@ -6,7 +6,6 @@ import java.nio.charset.StandardCharsets;
import java.security.GeneralSecurityException;
import java.security.MessageDigest;
import java.security.SecureRandom;
-import java.util.Base64;
/**
* Pagination markers that name a cursor, as AWS's opaque tokens do. Each marker is signed with a
@@ -27,7 +26,7 @@ public final class SignedMarkers {
public String cursorOf(String marker) {
String decoded;
try {
- decoded = new String(Base64.getUrlDecoder().decode(marker), StandardCharsets.UTF_8);
+ decoded = Base64Url.decode(marker);
} catch (IllegalArgumentException notIssued) {
// Not base64url, so not a marker this instance issued.
return null;
diff --git a/src/main/java/io/github/hectorvent/floci/services/cloudwatch/logs/CloudWatchLogsService.java b/src/main/java/io/github/hectorvent/floci/services/cloudwatch/logs/CloudWatchLogsService.java
index 611d32467b..1eb53bb8e4 100644
--- a/src/main/java/io/github/hectorvent/floci/services/cloudwatch/logs/CloudWatchLogsService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/cloudwatch/logs/CloudWatchLogsService.java
@@ -31,10 +31,8 @@ import jakarta.enterprise.event.Event;
import jakarta.inject.Inject;
import org.jboss.logging.Logger;
-import java.nio.charset.StandardCharsets;
import java.time.Instant;
import java.util.ArrayList;
-import java.util.Base64;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
@@ -618,7 +616,7 @@ public class CloudWatchLogsService implements ResourceProvider, Resettable {
int maxResults, String region) {
String[] parts;
try {
- String raw = new String(Base64.getUrlDecoder().decode(nextToken), StandardCharsets.UTF_8);
+ String raw = Base64Url.decode(nextToken);
parts = raw.split(":", 3);
} catch (IllegalArgumentException e) {
throw invalidNextToken();
diff --git a/src/main/java/io/github/hectorvent/floci/services/cognito/CognitoService.java b/src/main/java/io/github/hectorvent/floci/services/cognito/CognitoService.java
index 16b148537a..014487b41f 100644
--- a/src/main/java/io/github/hectorvent/floci/services/cognito/CognitoService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/cognito/CognitoService.java
@@ -5608,8 +5608,7 @@ public class CognitoService implements ResourceProvider {
System.arraycopy(parts, usernameEnd, fields, 2, 3);
fields[5] = hasAuthTime ? parts[end].substring(REFRESH_TOKEN_AUTH_TIME_FIELD.length()) : "";
if (hasScopes) {
- fields[6] = new String(Base64.getUrlDecoder().decode(
- parts[parts.length - 1].substring(REFRESH_TOKEN_SCOPE_FIELD.length())), StandardCharsets.UTF_8);
+ fields[6] = Base64Url.decode(parts[parts.length - 1].substring(REFRESH_TOKEN_SCOPE_FIELD.length()));
}
return fields;
} catch (Exception ignored) { }
diff --git a/src/main/java/io/github/hectorvent/floci/services/dsql/DsqlService.java b/src/main/java/io/github/hectorvent/floci/services/dsql/DsqlService.java
index e204d422b9..1c70c75278 100644
--- a/src/main/java/io/github/hectorvent/floci/services/dsql/DsqlService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/dsql/DsqlService.java
@@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.hectorvent.floci.config.EmulatorConfig;
import io.github.hectorvent.floci.core.common.AwsArnUtils;
import io.github.hectorvent.floci.core.common.AwsException;
+import io.github.hectorvent.floci.core.common.Base64Url;
import io.github.hectorvent.floci.core.common.Digests;
import io.github.hectorvent.floci.core.common.RegionResolver;
import io.github.hectorvent.floci.core.common.Resettable;
@@ -624,7 +625,7 @@ public class DsqlService implements Resettable {
private static String[] tokenPosition(String nextToken) {
try {
- String[] position = new String(Base64.getUrlDecoder().decode(nextToken), StandardCharsets.UTF_8)
+ String[] position = Base64Url.decode(nextToken)
.split(" ", 2);
if (position.length == 2) {
Instant.parse(position[0]);
diff --git a/src/main/java/io/github/hectorvent/floci/services/ecs/EcsService.java b/src/main/java/io/github/hectorvent/floci/services/ecs/EcsService.java
index cc68a7ab38..0b31b7eec1 100644
--- a/src/main/java/io/github/hectorvent/floci/services/ecs/EcsService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/ecs/EcsService.java
@@ -86,7 +86,6 @@ import java.time.Duration;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
-import java.util.Base64;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
@@ -2488,8 +2487,7 @@ public class EcsService implements ContainerTeardown, ResourceProvider, Resettab
return 0;
}
try {
- return Integer.parseInt(new String(Base64.getUrlDecoder().decode(nextToken),
- StandardCharsets.UTF_8));
+ return Integer.parseInt(Base64Url.decode(nextToken));
} catch (IllegalArgumentException e) {
throw new AwsException("InvalidParameterException", "The nextToken is not valid.", 400);
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/eks/EksAccessEntryService.java b/src/main/java/io/github/hectorvent/floci/services/eks/EksAccessEntryService.java
index b956bc7be4..cfdca7406c 100644
--- a/src/main/java/io/github/hectorvent/floci/services/eks/EksAccessEntryService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/eks/EksAccessEntryService.java
@@ -17,9 +17,7 @@ import io.quarkus.runtime.annotations.RegisterForReflection;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
-import java.nio.charset.StandardCharsets;
import java.time.Instant;
-import java.util.Base64;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
@@ -165,7 +163,7 @@ public class EksAccessEntryService {
String after = "";
if (nextToken != null) {
try {
- String decoded = new String(Base64.getUrlDecoder().decode(nextToken), StandardCharsets.UTF_8);
+ String decoded = Base64Url.decode(nextToken);
if (!decoded.startsWith(prefix + "\n")) {
throw invalid("nextToken does not belong to this cluster");
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/eks/EksPodIdentityAssociationService.java b/src/main/java/io/github/hectorvent/floci/services/eks/EksPodIdentityAssociationService.java
index 5c78db78dd..8af2fb8355 100644
--- a/src/main/java/io/github/hectorvent/floci/services/eks/EksPodIdentityAssociationService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/eks/EksPodIdentityAssociationService.java
@@ -18,10 +18,8 @@ import io.quarkus.runtime.annotations.RegisterForReflection;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
-import java.nio.charset.StandardCharsets;
import java.security.SecureRandom;
import java.time.Instant;
-import java.util.Base64;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
@@ -246,7 +244,7 @@ public class EksPodIdentityAssociationService {
String after = "";
if (nextToken != null && !nextToken.isBlank()) {
try {
- String decoded = new String(Base64.getUrlDecoder().decode(nextToken), StandardCharsets.UTF_8);
+ String decoded = Base64Url.decode(nextToken);
if (!decoded.startsWith(prefix + "\n")) {
throw invalid("nextToken does not belong to this cluster");
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/eks/EksTokenValidator.java b/src/main/java/io/github/hectorvent/floci/services/eks/EksTokenValidator.java
index b424036962..10a2a1c036 100644
--- a/src/main/java/io/github/hectorvent/floci/services/eks/EksTokenValidator.java
+++ b/src/main/java/io/github/hectorvent/floci/services/eks/EksTokenValidator.java
@@ -1,5 +1,6 @@
package io.github.hectorvent.floci.services.eks;
+import io.github.hectorvent.floci.core.common.Base64Url;
import io.github.hectorvent.floci.core.common.Digests;
import io.github.hectorvent.floci.services.iam.IamService;
import jakarta.enterprise.context.ApplicationScoped;
@@ -17,7 +18,6 @@ import java.time.Duration;
import java.time.Instant;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
-import java.util.Base64;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Locale;
@@ -118,7 +118,7 @@ class EksTokenValidator {
if (encodedRequest.isBlank()) {
return null;
}
- String decodedRequest = new String(Base64.getUrlDecoder().decode(encodedRequest), StandardCharsets.UTF_8);
+ String decodedRequest = Base64Url.decode(encodedRequest);
URI request = URI.create(decodedRequest);
if (!"http".equals(request.getScheme()) && !"https".equals(request.getScheme())) {
return null;
diff --git a/src/main/java/io/github/hectorvent/floci/services/fis/FisService.java b/src/main/java/io/github/hectorvent/floci/services/fis/FisService.java
index 885a84acdd..df4eb8ea10 100644
--- a/src/main/java/io/github/hectorvent/floci/services/fis/FisService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/fis/FisService.java
@@ -22,11 +22,9 @@ import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import java.math.BigInteger;
-import java.nio.charset.StandardCharsets;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Base64;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
@@ -1312,7 +1310,7 @@ public class FisService implements TagHandler {
throw validation("Invalid nextToken.");
}
try {
- String raw = new String(Base64.getUrlDecoder().decode(token), StandardCharsets.UTF_8);
+ String raw = Base64Url.decode(token);
int separator = raw.indexOf('\n');
if (separator < 0 || !expectedScope.equals(raw.substring(0, separator))
|| separator == raw.length() - 1) {
diff --git a/src/main/java/io/github/hectorvent/floci/services/guardduty/GuardDutyService.java b/src/main/java/io/github/hectorvent/floci/services/guardduty/GuardDutyService.java
index 5536857afb..4aca01967c 100644
--- a/src/main/java/io/github/hectorvent/floci/services/guardduty/GuardDutyService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/guardduty/GuardDutyService.java
@@ -618,7 +618,7 @@ public class GuardDutyService {
return null;
}
try {
- String decoded = new String(Base64.getUrlDecoder().decode(token), StandardCharsets.UTF_8);
+ String decoded = Base64Url.decode(token);
if (decoded.startsWith(PLAN_TOKEN_PREFIX) && decoded.length() > PLAN_TOKEN_PREFIX.length()) {
return decoded.substring(PLAN_TOKEN_PREFIX.length());
}
@@ -1074,7 +1074,7 @@ public class GuardDutyService {
return 0;
}
try {
- String decoded = new String(Base64.getUrlDecoder().decode(token), StandardCharsets.UTF_8);
+ String decoded = Base64Url.decode(token);
if (!decoded.startsWith(TOKEN_PREFIX)) {
throw badRequest("nextToken is invalid.");
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/identitystore/ScimController.java b/src/main/java/io/github/hectorvent/floci/services/identitystore/ScimController.java
index c45e0f2c04..3851fea18a 100644
--- a/src/main/java/io/github/hectorvent/floci/services/identitystore/ScimController.java
+++ b/src/main/java/io/github/hectorvent/floci/services/identitystore/ScimController.java
@@ -32,7 +32,6 @@ import jakarta.ws.rs.core.UriInfo;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
-import java.util.Base64;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -1375,7 +1374,7 @@ public class ScimController {
throw validation("cursor is invalid.");
}
try {
- String decoded = new String(Base64.getUrlDecoder().decode(cursor), StandardCharsets.UTF_8);
+ String decoded = Base64Url.decode(cursor);
int separator = decoded.indexOf('\n');
if (separator <= 0) {
throw validation("cursor is invalid.");
diff --git a/src/main/java/io/github/hectorvent/floci/services/iot/IotFleetIndexingService.java b/src/main/java/io/github/hectorvent/floci/services/iot/IotFleetIndexingService.java
index 79bd1a1369..db3d1f9280 100644
--- a/src/main/java/io/github/hectorvent/floci/services/iot/IotFleetIndexingService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/iot/IotFleetIndexingService.java
@@ -23,7 +23,6 @@ import jakarta.inject.Inject;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
-import java.util.Base64;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
@@ -267,7 +266,7 @@ public class IotFleetIndexingService {
}
Matcher token;
try {
- token = PAGE_TOKEN.matcher(new String(Base64.getUrlDecoder().decode(nextToken), StandardCharsets.UTF_8));
+ token = PAGE_TOKEN.matcher(Base64Url.decode(nextToken));
} catch (IllegalArgumentException e) {
throw invalid("Invalid nextToken");
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/kinesis/KinesisJsonHandler.java b/src/main/java/io/github/hectorvent/floci/services/kinesis/KinesisJsonHandler.java
index da513a9685..dce8899831 100644
--- a/src/main/java/io/github/hectorvent/floci/services/kinesis/KinesisJsonHandler.java
+++ b/src/main/java/io/github/hectorvent/floci/services/kinesis/KinesisJsonHandler.java
@@ -273,7 +273,7 @@ public class KinesisJsonHandler {
throw invalidNextToken();
}
try {
- String cursor = new String(Base64.getUrlDecoder().decode(token.cursor()), StandardCharsets.UTF_8);
+ String cursor = Base64Url.decode(token.cursor());
if (!Base64Url.encode(cursor).equals(token.cursor())) {
throw invalidNextToken();
}
@@ -824,7 +824,7 @@ public class KinesisJsonHandler {
}
String decoded;
try {
- decoded = new String(Base64.getUrlDecoder().decode(nextToken), StandardCharsets.UTF_8);
+ decoded = Base64Url.decode(nextToken);
} catch (IllegalArgumentException e) {
throw invalidNextToken();
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/lambdaweb/LambdaWebService.java b/src/main/java/io/github/hectorvent/floci/services/lambdaweb/LambdaWebService.java
index ea3cf68bb5..83d3cece2a 100644
--- a/src/main/java/io/github/hectorvent/floci/services/lambdaweb/LambdaWebService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/lambdaweb/LambdaWebService.java
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.hectorvent.floci.config.EmulatorConfig;
import io.github.hectorvent.floci.core.common.AwsArnUtils;
import io.github.hectorvent.floci.core.common.AwsException;
+import io.github.hectorvent.floci.core.common.Base64Url;
import io.github.hectorvent.floci.core.common.PaginatedResult;
import io.github.hectorvent.floci.core.common.Pagination;
import io.github.hectorvent.floci.core.common.RegionResolver;
@@ -30,11 +31,9 @@ import org.jboss.logging.Logger;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.net.URI;
-import java.nio.charset.StandardCharsets;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
-import java.util.Base64;
import java.util.Comparator;
import java.util.Iterator;
import java.util.LinkedHashMap;
@@ -1601,7 +1600,7 @@ public class LambdaWebService implements Resettable {
private static AwsException tokenError(String token) {
String decoded;
try {
- decoded = new String(Base64.getUrlDecoder().decode(token), StandardCharsets.UTF_8);
+ decoded = Base64Url.decode(token);
} catch (IllegalArgumentException expected) {
// Not base64, so not a token Floci issued.
decoded = "";
diff --git a/src/main/java/io/github/hectorvent/floci/services/macie2/MacieService.java b/src/main/java/io/github/hectorvent/floci/services/macie2/MacieService.java
index b180eb0aab..65f8c6d79e 100644
--- a/src/main/java/io/github/hectorvent/floci/services/macie2/MacieService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/macie2/MacieService.java
@@ -12,10 +12,8 @@ import io.github.hectorvent.floci.services.macie2.model.MacieState;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
-import java.nio.charset.StandardCharsets;
import java.time.Instant;
import java.util.ArrayList;
-import java.util.Base64;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
@@ -196,7 +194,7 @@ public class MacieService implements Resettable {
return 0;
}
try {
- int offset = Integer.parseInt(new String(Base64.getUrlDecoder().decode(token), StandardCharsets.UTF_8));
+ int offset = Integer.parseInt(Base64Url.decode(token));
if (offset < 0 || offset > size) {
throw validation("nextToken is invalid.");
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/oam/OamService.java b/src/main/java/io/github/hectorvent/floci/services/oam/OamService.java
index be2fd7a06d..21f0d998de 100644
--- a/src/main/java/io/github/hectorvent/floci/services/oam/OamService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/oam/OamService.java
@@ -15,9 +15,7 @@ import io.github.hectorvent.floci.services.oam.model.OamSink;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
-import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
-import java.util.Base64;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;
@@ -381,7 +379,7 @@ public class OamService {
public static int decodeToken(String token) {
if (token == null || token.isBlank()) return 0;
try {
- int offset = Integer.parseInt(new String(Base64.getUrlDecoder().decode(token), StandardCharsets.UTF_8));
+ int offset = Integer.parseInt(Base64Url.decode(token));
if (offset < 0) throw new NumberFormatException();
return offset;
} catch (Exception e) {
diff --git a/src/main/java/io/github/hectorvent/floci/services/rum/RumService.java b/src/main/java/io/github/hectorvent/floci/services/rum/RumService.java
index ee447ba48a..f2ac7d9e8c 100644
--- a/src/main/java/io/github/hectorvent/floci/services/rum/RumService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/rum/RumService.java
@@ -17,13 +17,11 @@ import io.github.hectorvent.floci.services.rum.model.AppMonitor;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
-import java.nio.charset.StandardCharsets;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
-import java.util.Base64;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.List;
@@ -487,7 +485,7 @@ public class RumService implements ResourceProvider {
return 0;
}
try {
- String decoded = new String(Base64.getUrlDecoder().decode(token), StandardCharsets.UTF_8);
+ String decoded = Base64Url.decode(token);
if (!decoded.startsWith(TOKEN_PREFIX)) {
throw validation("nextToken is invalid.");
}
diff --git a/src/main/java/io/github/hectorvent/floci/services/s3/S3Service.java b/src/main/java/io/github/hectorvent/floci/services/s3/S3Service.java
index 92a8d9f94e..caf6f41e38 100644
--- a/src/main/java/io/github/hectorvent/floci/services/s3/S3Service.java
+++ b/src/main/java/io/github/hectorvent/floci/services/s3/S3Service.java
@@ -3662,7 +3662,7 @@ public class S3Service implements Resettable, ResourceProvider {
return null;
}
try {
- return new String(Base64.getUrlDecoder().decode(token), StandardCharsets.UTF_8);
+ return Base64Url.decode(token);
} catch (IllegalArgumentException e) {
throw new AwsException("InvalidArgument", "The continuation token you provided is invalid.", 400);
}
diff --git a/src/test/java/io/github/hectorvent/floci/core/common/Base64UrlTest.java b/src/test/java/io/github/hectorvent/floci/core/common/Base64UrlTest.java
index a062de5da2..b6acd0c0bd 100644
--- a/src/test/java/io/github/hectorvent/floci/core/common/Base64UrlTest.java
+++ b/src/test/java/io/github/hectorvent/floci/core/common/Base64UrlTest.java
@@ -3,6 +3,7 @@ package io.github.hectorvent.floci.core.common;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
class Base64UrlTest {
@@ -15,4 +16,19 @@ class Base64UrlTest {
void encodesTextAsUtf8() {
assertEquals("w6k", Base64Url.encode("é"));
}
+
+ @Test
+ void decodesUnpaddedTextAsUtf8() {
+ assertEquals("é", Base64Url.decode("w6k"));
+ }
+
+ @Test
+ void decodesPaddedText() {
+ assertEquals("é", Base64Url.decode("w6k="));
+ }
+
+ @Test
+ void refusesTextThatIsNotBase64Url() {
+ assertThrows(IllegalArgumentException.class, () -> Base64Url.decode("!!!"));
+ }
}