diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/auth/HttpSignatureAuth.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/auth/HttpSignatureAuth.mustache index 744f9f6bd4..787bef3db0 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/auth/HttpSignatureAuth.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/auth/HttpSignatureAuth.mustache @@ -49,6 +49,9 @@ public class HttpSignatureAuth implements Authentication { // The digest algorithm which is used to calculate a cryptographic digest of the HTTP request body. private String digestAlgorithm; + // The maximum validity duration of the HTTP signature. + private Long maxSignatureValidity; + /** * Construct a new HTTP signature auth configuration object. * @@ -57,19 +60,23 @@ public class HttpSignatureAuth implements Authentication { * @param algorithm The cryptographic algorithm. * @param digestAlgorithm The digest algorithm. * @param headers The list of HTTP headers that should be included in the HTTP signature. + * @param maxSignatureValidity The maximum validity duration of the HTTP signature. + * Used to set the '(expires)' field in the HTTP signature. */ public HttpSignatureAuth(String keyId, SigningAlgorithm signingAlgorithm, Algorithm algorithm, String digestAlgorithm, AlgorithmParameterSpec parameterSpec, - List headers) { + List headers, + Long maxSignatureValidity) { this.keyId = keyId; this.signingAlgorithm = signingAlgorithm; this.algorithm = algorithm; this.parameterSpec = parameterSpec; this.digestAlgorithm = digestAlgorithm; this.headers = headers; + this.maxSignatureValidity = maxSignatureValidity; } /** @@ -179,6 +186,14 @@ public class HttpSignatureAuth implements Authentication { this.headers = headers; } + /** + * Returns the maximum validity duration of the HTTP signature. + * @return The maximum validity duration of the HTTP signature. + */ + public Long getMaxSignatureValidity() { + return maxSignatureValidity; + } + /** * Returns the signer instance used to sign HTTP messages. * @@ -209,7 +224,7 @@ public class HttpSignatureAuth implements Authentication { if (key == null) { throw new ApiException("Private key (java.security.Key) cannot be null"); } - signer = new Signer(key, new Signature(keyId, signingAlgorithm, algorithm, parameterSpec, null, headers)); + signer = new Signer(key, new Signature(keyId, signingAlgorithm, algorithm, parameterSpec, null, headers, maxSignatureValidity)); } @Override diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache index 155f306546..4b6850ff23 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache @@ -407,7 +407,7 @@ 1.3.2 4.13 {{#hasHttpSignatureMethods}} - 1.4 + 1.5 {{/hasHttpSignatureMethods}} {{#hasOAuthMethods}} 6.9.0 diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/pom.xml b/samples/openapi3/client/petstore/java/jersey2-java8/pom.xml index 934db7c5ca..6a6527cd13 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/pom.xml +++ b/samples/openapi3/client/petstore/java/jersey2-java8/pom.xml @@ -308,7 +308,7 @@ 0.2.1 1.3.2 4.13 - 1.4 + 1.5 6.9.0 diff --git a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java index c1222a7fff..a85f4ae3a8 100644 --- a/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java +++ b/samples/openapi3/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/auth/HttpSignatureAuth.java @@ -60,6 +60,9 @@ public class HttpSignatureAuth implements Authentication { // The digest algorithm which is used to calculate a cryptographic digest of the HTTP request body. private String digestAlgorithm; + // The maximum validity duration of the HTTP signature. + private Long maxSignatureValidity; + /** * Construct a new HTTP signature auth configuration object. * @@ -68,19 +71,23 @@ public class HttpSignatureAuth implements Authentication { * @param algorithm The cryptographic algorithm. * @param digestAlgorithm The digest algorithm. * @param headers The list of HTTP headers that should be included in the HTTP signature. + * @param maxSignatureValidity The maximum validity duration of the HTTP signature. + * Used to set the '(expires)' field in the HTTP signature. */ public HttpSignatureAuth(String keyId, SigningAlgorithm signingAlgorithm, Algorithm algorithm, String digestAlgorithm, AlgorithmParameterSpec parameterSpec, - List headers) { + List headers, + Long maxSignatureValidity) { this.keyId = keyId; this.signingAlgorithm = signingAlgorithm; this.algorithm = algorithm; this.parameterSpec = parameterSpec; this.digestAlgorithm = digestAlgorithm; this.headers = headers; + this.maxSignatureValidity = maxSignatureValidity; } /** @@ -190,6 +197,14 @@ public class HttpSignatureAuth implements Authentication { this.headers = headers; } + /** + * Returns the maximum validity duration of the HTTP signature. + * @return The maximum validity duration of the HTTP signature. + */ + public Long getMaxSignatureValidity() { + return maxSignatureValidity; + } + /** * Returns the signer instance used to sign HTTP messages. * @@ -220,7 +235,7 @@ public class HttpSignatureAuth implements Authentication { if (key == null) { throw new ApiException("Private key (java.security.Key) cannot be null"); } - signer = new Signer(key, new Signature(keyId, signingAlgorithm, algorithm, parameterSpec, null, headers)); + signer = new Signer(key, new Signature(keyId, signingAlgorithm, algorithm, parameterSpec, null, headers, maxSignatureValidity)); } @Override