diff --git a/modules/openapi-generator/src/main/resources/JavaPlayFramework/securityApiUtils.mustache b/modules/openapi-generator/src/main/resources/JavaPlayFramework/securityApiUtils.mustache index 4e0fa109125..3ab86bfd034 100644 --- a/modules/openapi-generator/src/main/resources/JavaPlayFramework/securityApiUtils.mustache +++ b/modules/openapi-generator/src/main/resources/JavaPlayFramework/securityApiUtils.mustache @@ -42,6 +42,7 @@ public class SecurityAPIUtils { private final HashMap tokenIntrospectEndpoints = new HashMap<>(); private final String clientId; private final String clientSecret; + private final long leeway; // Offline validation private final HashMap jwksEndpoints = new HashMap<>(); @@ -54,6 +55,7 @@ public class SecurityAPIUtils { clientId = configuration.hasPath("oauth.clientId") ? configuration.getString("oauth.clientId") : ""; clientSecret = configuration.hasPath("oauth.clientSecret") ? configuration.getString("oauth.clientSecret") : ""; + leeway = configuration.hasPath("oauth.leeway") ? configuration.getLong("oauth.leeway") : 3; {{#hasOAuthMethods}} {{#oauthMethods}} @@ -135,6 +137,7 @@ public class SecurityAPIUtils { Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) publicKey, null); tokenVerifier = JWT.require(algorithm) .withIssuer(issuer) + .acceptLeeway(leeway) .build(); tokenKeyId = keyId; } diff --git a/samples/server/petstore/java-play-framework-api-package-override/app/openapitools/SecurityAPIUtils.java b/samples/server/petstore/java-play-framework-api-package-override/app/openapitools/SecurityAPIUtils.java index 6ea699069b1..a0fdbc946ff 100644 --- a/samples/server/petstore/java-play-framework-api-package-override/app/openapitools/SecurityAPIUtils.java +++ b/samples/server/petstore/java-play-framework-api-package-override/app/openapitools/SecurityAPIUtils.java @@ -42,6 +42,7 @@ public class SecurityAPIUtils { private final HashMap tokenIntrospectEndpoints = new HashMap<>(); private final String clientId; private final String clientSecret; + private final long leeway; // Offline validation private final HashMap jwksEndpoints = new HashMap<>(); @@ -54,6 +55,7 @@ public class SecurityAPIUtils { clientId = configuration.hasPath("oauth.clientId") ? configuration.getString("oauth.clientId") : ""; clientSecret = configuration.hasPath("oauth.clientSecret") ? configuration.getString("oauth.clientSecret") : ""; + leeway = configuration.hasPath("oauth.leeway") ? configuration.getLong("oauth.leeway") : 3; tokenIntrospectEndpoints.put("petstore_auth", ""); @@ -127,6 +129,7 @@ public class SecurityAPIUtils { Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) publicKey, null); tokenVerifier = JWT.require(algorithm) .withIssuer(issuer) + .acceptLeeway(leeway) .build(); tokenKeyId = keyId; } diff --git a/samples/server/petstore/java-play-framework-async/app/openapitools/SecurityAPIUtils.java b/samples/server/petstore/java-play-framework-async/app/openapitools/SecurityAPIUtils.java index 6ea699069b1..a0fdbc946ff 100644 --- a/samples/server/petstore/java-play-framework-async/app/openapitools/SecurityAPIUtils.java +++ b/samples/server/petstore/java-play-framework-async/app/openapitools/SecurityAPIUtils.java @@ -42,6 +42,7 @@ public class SecurityAPIUtils { private final HashMap tokenIntrospectEndpoints = new HashMap<>(); private final String clientId; private final String clientSecret; + private final long leeway; // Offline validation private final HashMap jwksEndpoints = new HashMap<>(); @@ -54,6 +55,7 @@ public class SecurityAPIUtils { clientId = configuration.hasPath("oauth.clientId") ? configuration.getString("oauth.clientId") : ""; clientSecret = configuration.hasPath("oauth.clientSecret") ? configuration.getString("oauth.clientSecret") : ""; + leeway = configuration.hasPath("oauth.leeway") ? configuration.getLong("oauth.leeway") : 3; tokenIntrospectEndpoints.put("petstore_auth", ""); @@ -127,6 +129,7 @@ public class SecurityAPIUtils { Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) publicKey, null); tokenVerifier = JWT.require(algorithm) .withIssuer(issuer) + .acceptLeeway(leeway) .build(); tokenKeyId = keyId; } diff --git a/samples/server/petstore/java-play-framework-controller-only/app/openapitools/SecurityAPIUtils.java b/samples/server/petstore/java-play-framework-controller-only/app/openapitools/SecurityAPIUtils.java index 6ea699069b1..a0fdbc946ff 100644 --- a/samples/server/petstore/java-play-framework-controller-only/app/openapitools/SecurityAPIUtils.java +++ b/samples/server/petstore/java-play-framework-controller-only/app/openapitools/SecurityAPIUtils.java @@ -42,6 +42,7 @@ public class SecurityAPIUtils { private final HashMap tokenIntrospectEndpoints = new HashMap<>(); private final String clientId; private final String clientSecret; + private final long leeway; // Offline validation private final HashMap jwksEndpoints = new HashMap<>(); @@ -54,6 +55,7 @@ public class SecurityAPIUtils { clientId = configuration.hasPath("oauth.clientId") ? configuration.getString("oauth.clientId") : ""; clientSecret = configuration.hasPath("oauth.clientSecret") ? configuration.getString("oauth.clientSecret") : ""; + leeway = configuration.hasPath("oauth.leeway") ? configuration.getLong("oauth.leeway") : 3; tokenIntrospectEndpoints.put("petstore_auth", ""); @@ -127,6 +129,7 @@ public class SecurityAPIUtils { Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) publicKey, null); tokenVerifier = JWT.require(algorithm) .withIssuer(issuer) + .acceptLeeway(leeway) .build(); tokenKeyId = keyId; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints-with-security/app/openapitools/SecurityAPIUtils.java b/samples/server/petstore/java-play-framework-fake-endpoints-with-security/app/openapitools/SecurityAPIUtils.java index 59eb09ed43d..e2b1202cdb2 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints-with-security/app/openapitools/SecurityAPIUtils.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints-with-security/app/openapitools/SecurityAPIUtils.java @@ -42,6 +42,7 @@ public class SecurityAPIUtils { private final HashMap tokenIntrospectEndpoints = new HashMap<>(); private final String clientId; private final String clientSecret; + private final long leeway; // Offline validation private final HashMap jwksEndpoints = new HashMap<>(); @@ -54,6 +55,7 @@ public class SecurityAPIUtils { clientId = configuration.hasPath("oauth.clientId") ? configuration.getString("oauth.clientId") : ""; clientSecret = configuration.hasPath("oauth.clientSecret") ? configuration.getString("oauth.clientSecret") : ""; + leeway = configuration.hasPath("oauth.leeway") ? configuration.getLong("oauth.leeway") : 3; tokenIntrospectEndpoints.put("petstore_token", "https://keycloak-dev.business.stingray.com/auth/realms/CSLocal/protocol/openid-connect/token/introspect"); @@ -127,6 +129,7 @@ public class SecurityAPIUtils { Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) publicKey, null); tokenVerifier = JWT.require(algorithm) .withIssuer(issuer) + .acceptLeeway(leeway) .build(); tokenKeyId = keyId; } diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/app/openapitools/SecurityAPIUtils.java b/samples/server/petstore/java-play-framework-fake-endpoints/app/openapitools/SecurityAPIUtils.java index 6ea699069b1..a0fdbc946ff 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/app/openapitools/SecurityAPIUtils.java +++ b/samples/server/petstore/java-play-framework-fake-endpoints/app/openapitools/SecurityAPIUtils.java @@ -42,6 +42,7 @@ public class SecurityAPIUtils { private final HashMap tokenIntrospectEndpoints = new HashMap<>(); private final String clientId; private final String clientSecret; + private final long leeway; // Offline validation private final HashMap jwksEndpoints = new HashMap<>(); @@ -54,6 +55,7 @@ public class SecurityAPIUtils { clientId = configuration.hasPath("oauth.clientId") ? configuration.getString("oauth.clientId") : ""; clientSecret = configuration.hasPath("oauth.clientSecret") ? configuration.getString("oauth.clientSecret") : ""; + leeway = configuration.hasPath("oauth.leeway") ? configuration.getLong("oauth.leeway") : 3; tokenIntrospectEndpoints.put("petstore_auth", ""); @@ -127,6 +129,7 @@ public class SecurityAPIUtils { Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) publicKey, null); tokenVerifier = JWT.require(algorithm) .withIssuer(issuer) + .acceptLeeway(leeway) .build(); tokenKeyId = keyId; } diff --git a/samples/server/petstore/java-play-framework-no-bean-validation/app/openapitools/SecurityAPIUtils.java b/samples/server/petstore/java-play-framework-no-bean-validation/app/openapitools/SecurityAPIUtils.java index 6ea699069b1..a0fdbc946ff 100644 --- a/samples/server/petstore/java-play-framework-no-bean-validation/app/openapitools/SecurityAPIUtils.java +++ b/samples/server/petstore/java-play-framework-no-bean-validation/app/openapitools/SecurityAPIUtils.java @@ -42,6 +42,7 @@ public class SecurityAPIUtils { private final HashMap tokenIntrospectEndpoints = new HashMap<>(); private final String clientId; private final String clientSecret; + private final long leeway; // Offline validation private final HashMap jwksEndpoints = new HashMap<>(); @@ -54,6 +55,7 @@ public class SecurityAPIUtils { clientId = configuration.hasPath("oauth.clientId") ? configuration.getString("oauth.clientId") : ""; clientSecret = configuration.hasPath("oauth.clientSecret") ? configuration.getString("oauth.clientSecret") : ""; + leeway = configuration.hasPath("oauth.leeway") ? configuration.getLong("oauth.leeway") : 3; tokenIntrospectEndpoints.put("petstore_auth", ""); @@ -127,6 +129,7 @@ public class SecurityAPIUtils { Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) publicKey, null); tokenVerifier = JWT.require(algorithm) .withIssuer(issuer) + .acceptLeeway(leeway) .build(); tokenKeyId = keyId; } diff --git a/samples/server/petstore/java-play-framework-no-exception-handling/app/openapitools/SecurityAPIUtils.java b/samples/server/petstore/java-play-framework-no-exception-handling/app/openapitools/SecurityAPIUtils.java index 6ea699069b1..a0fdbc946ff 100644 --- a/samples/server/petstore/java-play-framework-no-exception-handling/app/openapitools/SecurityAPIUtils.java +++ b/samples/server/petstore/java-play-framework-no-exception-handling/app/openapitools/SecurityAPIUtils.java @@ -42,6 +42,7 @@ public class SecurityAPIUtils { private final HashMap tokenIntrospectEndpoints = new HashMap<>(); private final String clientId; private final String clientSecret; + private final long leeway; // Offline validation private final HashMap jwksEndpoints = new HashMap<>(); @@ -54,6 +55,7 @@ public class SecurityAPIUtils { clientId = configuration.hasPath("oauth.clientId") ? configuration.getString("oauth.clientId") : ""; clientSecret = configuration.hasPath("oauth.clientSecret") ? configuration.getString("oauth.clientSecret") : ""; + leeway = configuration.hasPath("oauth.leeway") ? configuration.getLong("oauth.leeway") : 3; tokenIntrospectEndpoints.put("petstore_auth", ""); @@ -127,6 +129,7 @@ public class SecurityAPIUtils { Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) publicKey, null); tokenVerifier = JWT.require(algorithm) .withIssuer(issuer) + .acceptLeeway(leeway) .build(); tokenKeyId = keyId; } diff --git a/samples/server/petstore/java-play-framework-no-interface/app/openapitools/SecurityAPIUtils.java b/samples/server/petstore/java-play-framework-no-interface/app/openapitools/SecurityAPIUtils.java index 6ea699069b1..a0fdbc946ff 100644 --- a/samples/server/petstore/java-play-framework-no-interface/app/openapitools/SecurityAPIUtils.java +++ b/samples/server/petstore/java-play-framework-no-interface/app/openapitools/SecurityAPIUtils.java @@ -42,6 +42,7 @@ public class SecurityAPIUtils { private final HashMap tokenIntrospectEndpoints = new HashMap<>(); private final String clientId; private final String clientSecret; + private final long leeway; // Offline validation private final HashMap jwksEndpoints = new HashMap<>(); @@ -54,6 +55,7 @@ public class SecurityAPIUtils { clientId = configuration.hasPath("oauth.clientId") ? configuration.getString("oauth.clientId") : ""; clientSecret = configuration.hasPath("oauth.clientSecret") ? configuration.getString("oauth.clientSecret") : ""; + leeway = configuration.hasPath("oauth.leeway") ? configuration.getLong("oauth.leeway") : 3; tokenIntrospectEndpoints.put("petstore_auth", ""); @@ -127,6 +129,7 @@ public class SecurityAPIUtils { Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) publicKey, null); tokenVerifier = JWT.require(algorithm) .withIssuer(issuer) + .acceptLeeway(leeway) .build(); tokenKeyId = keyId; } diff --git a/samples/server/petstore/java-play-framework-no-nullable/app/openapitools/SecurityAPIUtils.java b/samples/server/petstore/java-play-framework-no-nullable/app/openapitools/SecurityAPIUtils.java index 6ea699069b1..a0fdbc946ff 100644 --- a/samples/server/petstore/java-play-framework-no-nullable/app/openapitools/SecurityAPIUtils.java +++ b/samples/server/petstore/java-play-framework-no-nullable/app/openapitools/SecurityAPIUtils.java @@ -42,6 +42,7 @@ public class SecurityAPIUtils { private final HashMap tokenIntrospectEndpoints = new HashMap<>(); private final String clientId; private final String clientSecret; + private final long leeway; // Offline validation private final HashMap jwksEndpoints = new HashMap<>(); @@ -54,6 +55,7 @@ public class SecurityAPIUtils { clientId = configuration.hasPath("oauth.clientId") ? configuration.getString("oauth.clientId") : ""; clientSecret = configuration.hasPath("oauth.clientSecret") ? configuration.getString("oauth.clientSecret") : ""; + leeway = configuration.hasPath("oauth.leeway") ? configuration.getLong("oauth.leeway") : 3; tokenIntrospectEndpoints.put("petstore_auth", ""); @@ -127,6 +129,7 @@ public class SecurityAPIUtils { Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) publicKey, null); tokenVerifier = JWT.require(algorithm) .withIssuer(issuer) + .acceptLeeway(leeway) .build(); tokenKeyId = keyId; } diff --git a/samples/server/petstore/java-play-framework-no-swagger-ui/app/openapitools/SecurityAPIUtils.java b/samples/server/petstore/java-play-framework-no-swagger-ui/app/openapitools/SecurityAPIUtils.java index 6ea699069b1..a0fdbc946ff 100644 --- a/samples/server/petstore/java-play-framework-no-swagger-ui/app/openapitools/SecurityAPIUtils.java +++ b/samples/server/petstore/java-play-framework-no-swagger-ui/app/openapitools/SecurityAPIUtils.java @@ -42,6 +42,7 @@ public class SecurityAPIUtils { private final HashMap tokenIntrospectEndpoints = new HashMap<>(); private final String clientId; private final String clientSecret; + private final long leeway; // Offline validation private final HashMap jwksEndpoints = new HashMap<>(); @@ -54,6 +55,7 @@ public class SecurityAPIUtils { clientId = configuration.hasPath("oauth.clientId") ? configuration.getString("oauth.clientId") : ""; clientSecret = configuration.hasPath("oauth.clientSecret") ? configuration.getString("oauth.clientSecret") : ""; + leeway = configuration.hasPath("oauth.leeway") ? configuration.getLong("oauth.leeway") : 3; tokenIntrospectEndpoints.put("petstore_auth", ""); @@ -127,6 +129,7 @@ public class SecurityAPIUtils { Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) publicKey, null); tokenVerifier = JWT.require(algorithm) .withIssuer(issuer) + .acceptLeeway(leeway) .build(); tokenKeyId = keyId; } diff --git a/samples/server/petstore/java-play-framework-no-wrap-calls/app/openapitools/SecurityAPIUtils.java b/samples/server/petstore/java-play-framework-no-wrap-calls/app/openapitools/SecurityAPIUtils.java index 6ea699069b1..a0fdbc946ff 100644 --- a/samples/server/petstore/java-play-framework-no-wrap-calls/app/openapitools/SecurityAPIUtils.java +++ b/samples/server/petstore/java-play-framework-no-wrap-calls/app/openapitools/SecurityAPIUtils.java @@ -42,6 +42,7 @@ public class SecurityAPIUtils { private final HashMap tokenIntrospectEndpoints = new HashMap<>(); private final String clientId; private final String clientSecret; + private final long leeway; // Offline validation private final HashMap jwksEndpoints = new HashMap<>(); @@ -54,6 +55,7 @@ public class SecurityAPIUtils { clientId = configuration.hasPath("oauth.clientId") ? configuration.getString("oauth.clientId") : ""; clientSecret = configuration.hasPath("oauth.clientSecret") ? configuration.getString("oauth.clientSecret") : ""; + leeway = configuration.hasPath("oauth.leeway") ? configuration.getLong("oauth.leeway") : 3; tokenIntrospectEndpoints.put("petstore_auth", ""); @@ -127,6 +129,7 @@ public class SecurityAPIUtils { Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) publicKey, null); tokenVerifier = JWT.require(algorithm) .withIssuer(issuer) + .acceptLeeway(leeway) .build(); tokenKeyId = keyId; } diff --git a/samples/server/petstore/java-play-framework/app/openapitools/SecurityAPIUtils.java b/samples/server/petstore/java-play-framework/app/openapitools/SecurityAPIUtils.java index 6ea699069b1..a0fdbc946ff 100644 --- a/samples/server/petstore/java-play-framework/app/openapitools/SecurityAPIUtils.java +++ b/samples/server/petstore/java-play-framework/app/openapitools/SecurityAPIUtils.java @@ -42,6 +42,7 @@ public class SecurityAPIUtils { private final HashMap tokenIntrospectEndpoints = new HashMap<>(); private final String clientId; private final String clientSecret; + private final long leeway; // Offline validation private final HashMap jwksEndpoints = new HashMap<>(); @@ -54,6 +55,7 @@ public class SecurityAPIUtils { clientId = configuration.hasPath("oauth.clientId") ? configuration.getString("oauth.clientId") : ""; clientSecret = configuration.hasPath("oauth.clientSecret") ? configuration.getString("oauth.clientSecret") : ""; + leeway = configuration.hasPath("oauth.leeway") ? configuration.getLong("oauth.leeway") : 3; tokenIntrospectEndpoints.put("petstore_auth", ""); @@ -127,6 +129,7 @@ public class SecurityAPIUtils { Algorithm algorithm = Algorithm.RSA256((RSAPublicKey) publicKey, null); tokenVerifier = JWT.require(algorithm) .withIssuer(issuer) + .acceptLeeway(leeway) .build(); tokenKeyId = keyId; }