While the JWT family of specifications only defines the zip
header in the JWE (Json Web Encryption)
- * specification, JJWT will also support compression for JWS as well if you choose to use it. However,
- * be aware that if you use
- * compression when creating a JWS token, other libraries may not be able to parse the JWS. Compression when
- * creating JWE tokens however should be universally accepted for any library that supports JWE.
While the JWT family of specifications only defines the zip
header in the JWE
+ * (JSON Web Encryption) specification, JJWT will also support compression for JWS as well if you choose to use it.
+ * However, be aware that if you use compression when creating a JWS token, other libraries may not be able to
+ * parse the JWS. However, compression when creating JWE tokens should be universally accepted for any library
+ * that supports JWE.
While the JWT family of specifications only defines the zip
header in the JWE (Json Web Encryption)
- * specification, JJWT will also support compression for JWS as well if you choose to use it. However,
- * be aware that if you use
- * compression when creating a JWS token, other libraries may not be able to parse the JWS. Compression when
- * creating JWE tokens however should be universally accepted for any library that supports JWE.
While the JWT family of specifications only defines the zip
header in the JWE
+ * (JSON Web Encryption) specification, JJWT will also support compression for JWS as well if you choose to use it.
+ * However, be aware that if you use compression when creating a JWS token, other libraries may not be able to
+ * parse the JWS. However, Compression when creating JWE tokens should be universally accepted for any library
+ * that supports JWE.
The payload and claims properties are mutually exclusive - only one of the two may be used.
+ * + * @param claims the JWT claims to be added to the JWT body. + * @return the builder for method chaining. + * @since 0.8 + */ + JwtBuilder addClaims(Mapiss
(issuer) value. A {@code null} value will remove the property from the Claims.
@@ -358,10 +370,10 @@ public interface JwtBuilder extends ClaimsMutatorThe JWT family of specifications defines compression only for JWE (Json Web Encryption) + *
The JWT family of specifications defines compression only for JWE (JSON Web Encryption) * tokens. Even so, JJWT will also support compression for JWS tokens as well if you choose to use it. * However, be aware that if you use compression when creating a JWS token, other libraries may not be able to - * parse that JWS token. When using compression for JWS tokens, be sure that that all parties accessing the + * parse that JWS token. When using compression for JWS tokens, be sure that that all parties accessing the * JWS token support compression for JWS.
* *Compression when creating JWE tokens however should be universally accepted for any diff --git a/src/main/java/io/jsonwebtoken/JwtParser.java b/src/main/java/io/jsonwebtoken/JwtParser.java index fd1f6c7e..c0fa1603 100644 --- a/src/main/java/io/jsonwebtoken/JwtParser.java +++ b/src/main/java/io/jsonwebtoken/JwtParser.java @@ -187,9 +187,6 @@ public interface JwtParser { * (as the {@code alg} header parameter).
**
This method overwrites any previously set key.
- *- *
This is a convenience method: the string argument is first BASE64-decoded to a byte array and this resulting - * byte array is used to invoke {@link #setSigningKey(byte[])}.
* * @param key the algorithm-specific signature verification key to use to validate any discovered JWS digital * signature. diff --git a/src/main/java/io/jsonwebtoken/impl/DefaultJwtBuilder.java b/src/main/java/io/jsonwebtoken/impl/DefaultJwtBuilder.java index 76d3a2c3..25b48d62 100644 --- a/src/main/java/io/jsonwebtoken/impl/DefaultJwtBuilder.java +++ b/src/main/java/io/jsonwebtoken/impl/DefaultJwtBuilder.java @@ -17,14 +17,7 @@ package io.jsonwebtoken.impl; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import io.jsonwebtoken.Claims; -import io.jsonwebtoken.CompressionCodec; -import io.jsonwebtoken.Header; -import io.jsonwebtoken.JwsHeader; -import io.jsonwebtoken.JwtBuilder; -import io.jsonwebtoken.JwtParser; -import io.jsonwebtoken.Jwts; -import io.jsonwebtoken.SignatureAlgorithm; +import io.jsonwebtoken.*; import io.jsonwebtoken.impl.crypto.DefaultJwtSigner; import io.jsonwebtoken.impl.crypto.JwtSigner; import io.jsonwebtoken.lang.Assert; @@ -148,6 +141,12 @@ public class DefaultJwtBuilder implements JwtBuilder { return this; } + @Override + public JwtBuilder addClaims(Map