mirror of https://github.com/jwtk/jjwt.git
parent
ddeb39c557
commit
6fe3759d64
|
@ -105,6 +105,7 @@ public interface Header<T extends Header<T>> extends Map<String,Object> {
|
|||
* an example of a Nested JWT.</p>
|
||||
*
|
||||
* @param cty the JWT JOSE {@code cty} header value or {@code null} to remove the property from the JSON map.
|
||||
* @return the {@code Header} instance for method chaining.
|
||||
*/
|
||||
T setContentType(String cty);
|
||||
|
||||
|
@ -119,12 +120,13 @@ public interface Header<T extends Header<T>> extends Map<String,Object> {
|
|||
/**
|
||||
* Sets the JWT <code>zip</code> (Compression Algorithm) header parameter value. A {@code null} value will remove
|
||||
* the property from the JSON map.
|
||||
* <p>
|
||||
*
|
||||
* <p>The compression algorithm is NOT part of the <a href="https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-25">JWT specification</a>
|
||||
* and must be used carefully since, is not expected that other libraries (including previous versions of this one)
|
||||
* be able to deserialize a compressed JTW body correctly. </p>
|
||||
*
|
||||
* @param zip the JWT compression algorithm {@code zip} value or {@code null} to remove the property from the JSON map.
|
||||
* @return the {@code Header} instance for method chaining.
|
||||
* @since 0.6.0
|
||||
*/
|
||||
T setCompressionAlgorithm(String zip);
|
||||
|
|
|
@ -480,7 +480,7 @@ public interface JwtBuilder extends ClaimsMutator<JwtBuilder> {
|
|||
* <p>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 <b>if you use compression when creating a JWS token, other libraries may not be able to
|
||||
* parse that JWS token</b>. When using compression for JWS tokens, be sure that that all parties accessing the
|
||||
* parse that JWS token</b>. When using compression for JWS tokens, be sure that all parties accessing the
|
||||
* JWS token support compression for JWS.</p>
|
||||
*
|
||||
* <p>Compression when creating JWE tokens however should be universally accepted for any
|
||||
|
|
|
@ -83,13 +83,13 @@ public class JwtMap implements Map<String, Object> {
|
|||
} else if (v instanceof Number) {
|
||||
// https://github.com/jwtk/jjwt/issues/122:
|
||||
// The JWT RFC *mandates* NumericDate values are represented as seconds.
|
||||
// Because Because java.util.Date requires milliseconds, we need to multiply by 1000:
|
||||
// Because java.util.Date requires milliseconds, we need to multiply by 1000:
|
||||
long seconds = ((Number) v).longValue();
|
||||
v = seconds * 1000;
|
||||
} else if (v instanceof String) {
|
||||
// https://github.com/jwtk/jjwt/issues/122
|
||||
// The JWT RFC *mandates* NumericDate values are represented as seconds.
|
||||
// Because Because java.util.Date requires milliseconds, we need to multiply by 1000:
|
||||
// Because java.util.Date requires milliseconds, we need to multiply by 1000:
|
||||
try {
|
||||
long seconds = Long.parseLong((String) v);
|
||||
v = seconds * 1000;
|
||||
|
|
Loading…
Reference in New Issue