diff --git a/lib/src/main/java/com/auth0/jwt/JWTCreator.java b/lib/src/main/java/com/auth0/jwt/JWTCreator.java index bfcb9147..056e491c 100644 --- a/lib/src/main/java/com/auth0/jwt/JWTCreator.java +++ b/lib/src/main/java/com/auth0/jwt/JWTCreator.java @@ -253,96 +253,11 @@ public Builder withJWTId(String jwtId) { * * @param name the Claim's name. * @param value the Claim's value. + * @param the type of the claim value. * @return this same Builder instance. * @throws IllegalArgumentException if the name is null. */ - public Builder withClaim(String name, Boolean value) throws IllegalArgumentException { - assertNonNull(name); - addClaim(name, value); - return this; - } - - /** - * Add a custom Claim value. - * - * @param name the Claim's name. - * @param value the Claim's value. - * @return this same Builder instance. - * @throws IllegalArgumentException if the name is null. - */ - public Builder withClaim(String name, Integer value) throws IllegalArgumentException { - assertNonNull(name); - addClaim(name, value); - return this; - } - - /** - * Add a custom Claim value. - * - * @param name the Claim's name. - * @param value the Claim's value. - * @return this same Builder instance. - * @throws IllegalArgumentException if the name is null. - */ - public Builder withClaim(String name, Long value) throws IllegalArgumentException { - assertNonNull(name); - addClaim(name, value); - return this; - } - - /** - * Add a custom Claim value. - * - * @param name the Claim's name. - * @param value the Claim's value. - * @return this same Builder instance. - * @throws IllegalArgumentException if the name is null. - */ - public Builder withClaim(String name, Double value) throws IllegalArgumentException { - assertNonNull(name); - addClaim(name, value); - return this; - } - - /** - * Add a custom Claim value. - * - * @param name the Claim's name. - * @param value the Claim's value. - * @return this same Builder instance. - * @throws IllegalArgumentException if the name is null. - */ - public Builder withClaim(String name, String value) throws IllegalArgumentException { - assertNonNull(name); - addClaim(name, value); - return this; - } - - /** - * Add a custom Claim value. The claim will be written as seconds since the epoch. - * Milliseconds will be truncated by rounding down to the nearest second. - * - * @param name the Claim's name. - * @param value the Claim's value. - * @return this same Builder instance. - * @throws IllegalArgumentException if the name is null. - */ - public Builder withClaim(String name, Date value) throws IllegalArgumentException { - assertNonNull(name); - addClaim(name, value); - return this; - } - - /** - * Add a custom Claim value. The claim will be written as seconds since the epoch. - * Milliseconds will be truncated by rounding down to the nearest second. - * - * @param name the Claim's name. - * @param value the Claim's value. - * @return this same Builder instance. - * @throws IllegalArgumentException if the name is null. - */ - public Builder withClaim(String name, Instant value) throws IllegalArgumentException { + public Builder withClaim(String name, T value) throws IllegalArgumentException { assertNonNull(name); addClaim(name, value); return this; @@ -414,38 +329,11 @@ public Builder withNullClaim(String name) throws IllegalArgumentException { * * @param name the Claim's name. * @param items the Claim's value. + * @param the type of the array elements. * @return this same Builder instance. * @throws IllegalArgumentException if the name is null. */ - public Builder withArrayClaim(String name, String[] items) throws IllegalArgumentException { - assertNonNull(name); - addClaim(name, items); - return this; - } - - /** - * Add a custom Array Claim with the given items. - * - * @param name the Claim's name. - * @param items the Claim's value. - * @return this same Builder instance. - * @throws IllegalArgumentException if the name is null. - */ - public Builder withArrayClaim(String name, Integer[] items) throws IllegalArgumentException { - assertNonNull(name); - addClaim(name, items); - return this; - } - - /** - * Add a custom Array Claim with the given items. - * - * @param name the Claim's name. - * @param items the Claim's value. - * @return this same Builder instance. - * @throws IllegalArgumentException if the name is null - */ - public Builder withArrayClaim(String name, Long[] items) throws IllegalArgumentException { + public Builder withArrayClaim(String name, T[] items) throws IllegalArgumentException { assertNonNull(name); addClaim(name, items); return this; diff --git a/lib/src/main/java/com/auth0/jwt/JWTVerifier.java b/lib/src/main/java/com/auth0/jwt/JWTVerifier.java index bf180300..0a169505 100644 --- a/lib/src/main/java/com/auth0/jwt/JWTVerifier.java +++ b/lib/src/main/java/com/auth0/jwt/JWTVerifier.java @@ -52,7 +52,7 @@ static Verification init(Algorithm algorithm) throws IllegalArgumentException { * Note that this class is not thread-safe. Calling {@link #build()} returns an instance of * {@link com.auth0.jwt.interfaces.JWTVerifier} which can be reused. */ - public static class BaseVerification implements Verification { + static class BaseVerification implements Verification { private final Algorithm algorithm; private final List expectedChecks; private long defaultLeeway;