From 2e09ae9361e53be66ecfa833f20f55245ffd9891 Mon Sep 17 00:00:00 2001 From: Vorimo Date: Fri, 15 Jul 2022 16:56:55 +0300 Subject: [PATCH 1/2] Time properties renamed --- .../vertx/ext/auth/JWTOptionsConverter.java | 7 +++---- .../java/io/vertx/ext/auth/JWTOptions.java | 14 ++++++------- .../java/io/vertx/ext/auth/impl/jose/JWT.java | 4 ++-- .../auth/test/jwt/JWTAuthProviderTest.java | 4 ++-- .../auth/oauth2/OAuth2OptionsConverter.java | 6 +++--- .../vertx/ext/auth/oauth2/OAuth2Options.java | 20 +++++++++---------- .../oauth2/impl/OAuth2AuthProviderImpl.java | 2 +- .../webauthn/WebAuthnOptionsConverter.java | 9 ++++----- .../ext/auth/webauthn/WebAuthnOptions.java | 17 ++++++++-------- .../ext/auth/webauthn/impl/WebAuthnImpl.java | 4 ++-- .../AndroidSafetynetAttestation.java | 2 +- .../impl/attestation/AttestationTest.java | 2 +- 12 files changed, 45 insertions(+), 46 deletions(-) diff --git a/vertx-auth-common/src/main/generated/io/vertx/ext/auth/JWTOptionsConverter.java b/vertx-auth-common/src/main/generated/io/vertx/ext/auth/JWTOptionsConverter.java index d5a180132..27f90db60 100644 --- a/vertx-auth-common/src/main/generated/io/vertx/ext/auth/JWTOptionsConverter.java +++ b/vertx-auth-common/src/main/generated/io/vertx/ext/auth/JWTOptionsConverter.java @@ -3,8 +3,7 @@ import io.vertx.core.json.JsonObject; import io.vertx.core.json.JsonArray; import io.vertx.core.json.impl.JsonUtil; -import java.time.Instant; -import java.time.format.DateTimeFormatter; + import java.util.Base64; /** @@ -50,7 +49,7 @@ public static void fromJson(Iterable> json, break; case "expiresInSeconds": if (member.getValue() instanceof Number) { - obj.setExpiresInSeconds(((Number)member.getValue()).intValue()); + obj.setExpires(((Number)member.getValue()).intValue()); } break; case "header": @@ -115,7 +114,7 @@ public static void toJson(JWTOptions obj, java.util.Map json) { obj.getAudience().forEach(item -> array.add(item)); json.put("audience", array); } - json.put("expiresInSeconds", obj.getExpiresInSeconds()); + json.put("expiresInSeconds", obj.getExpires()); if (obj.getHeader() != null) { json.put("header", obj.getHeader()); } diff --git a/vertx-auth-common/src/main/java/io/vertx/ext/auth/JWTOptions.java b/vertx-auth-common/src/main/java/io/vertx/ext/auth/JWTOptions.java index 5ded669ac..2b7b06ee2 100644 --- a/vertx-auth-common/src/main/java/io/vertx/ext/auth/JWTOptions.java +++ b/vertx-auth-common/src/main/java/io/vertx/ext/auth/JWTOptions.java @@ -17,7 +17,7 @@ public class JWTOptions { private String algorithm = "HS256"; private JsonObject header = EMPTY; private boolean noTimestamp; - private int expiresInSeconds; + private int expires; private List audience; private String issuer; private String subject; @@ -33,7 +33,7 @@ public JWTOptions(JWTOptions other) { this.algorithm = other.algorithm; this.header = other.header; this.noTimestamp = other.noTimestamp; - this.expiresInSeconds = other.expiresInSeconds; + this.expires = other.expires; this.audience = other.audience; this.issuer = other.issuer; this.subject = other.subject; @@ -96,17 +96,17 @@ public JWTOptions setNoTimestamp(boolean noTimestamp) { return this; } - public int getExpiresInSeconds() { - return expiresInSeconds; + public int getExpires() { + return expires; } - public JWTOptions setExpiresInSeconds(int expiresInSeconds) { - this.expiresInSeconds = expiresInSeconds; + public JWTOptions setExpires(int expires) { + this.expires = expires; return this; } public JWTOptions setExpiresInMinutes(int expiresInMinutes) { - this.expiresInSeconds = expiresInMinutes * 60; + this.expires = expiresInMinutes * 60; return this; } diff --git a/vertx-auth-common/src/main/java/io/vertx/ext/auth/impl/jose/JWT.java b/vertx-auth-common/src/main/java/io/vertx/ext/auth/impl/jose/JWT.java index b6de32700..b0f5eebce 100644 --- a/vertx-auth-common/src/main/java/io/vertx/ext/auth/impl/jose/JWT.java +++ b/vertx-auth-common/src/main/java/io/vertx/ext/auth/impl/jose/JWT.java @@ -363,8 +363,8 @@ public String sign(JsonObject payload, JWTOptions options) { payload.put("iat", payload.getValue("iat", timestamp)); } - if (options.getExpiresInSeconds() > 0) { - payload.put("exp", timestamp + options.getExpiresInSeconds()); + if (options.getExpires() > 0) { + payload.put("exp", timestamp + options.getExpires()); } if (options.getAudience() != null && options.getAudience().size() >= 1) { diff --git a/vertx-auth-jwt/src/test/java/io/vertx/ext/auth/test/jwt/JWTAuthProviderTest.java b/vertx-auth-jwt/src/test/java/io/vertx/ext/auth/test/jwt/JWTAuthProviderTest.java index 03c44f0fb..e859039e9 100644 --- a/vertx-auth-jwt/src/test/java/io/vertx/ext/auth/test/jwt/JWTAuthProviderTest.java +++ b/vertx-auth-jwt/src/test/java/io/vertx/ext/auth/test/jwt/JWTAuthProviderTest.java @@ -232,7 +232,7 @@ public void testExpiration(TestContext should) { .put("sub", "Paulo"); final String token = authProvider.generateToken(payload, - new JWTOptions().setExpiresInSeconds(1).setNoTimestamp(true)); + new JWTOptions().setExpires(1).setNoTimestamp(true)); should.assertNotNull(token); @@ -628,7 +628,7 @@ public void testValidateTokenWithIgnoreExpired(TestContext should) throws Interr .generateToken( new JsonObject(), new JWTOptions() - .setExpiresInSeconds(1) + .setExpires(1) .setSubject("subject") .setAlgorithm("HS256")); diff --git a/vertx-auth-oauth2/src/main/generated/io/vertx/ext/auth/oauth2/OAuth2OptionsConverter.java b/vertx-auth-oauth2/src/main/generated/io/vertx/ext/auth/oauth2/OAuth2OptionsConverter.java index 8f657f679..e4f8ee05c 100644 --- a/vertx-auth-oauth2/src/main/generated/io/vertx/ext/auth/oauth2/OAuth2OptionsConverter.java +++ b/vertx-auth-oauth2/src/main/generated/io/vertx/ext/auth/oauth2/OAuth2OptionsConverter.java @@ -75,9 +75,9 @@ public static void fromJson(Iterable> json, obj.setIntrospectionPath((String)member.getValue()); } break; - case "jwkMaxAgeInSeconds": + case "jwkMaxAge": if (member.getValue() instanceof Number) { - obj.setJwkMaxAgeInSeconds(((Number)member.getValue()).longValue()); + obj.setJwkMaxAge(((Number)member.getValue()).longValue()); } break; case "jwkPath": @@ -207,7 +207,7 @@ public static void toJson(OAuth2Options obj, java.util.Map json) if (obj.getIntrospectionPath() != null) { json.put("introspectionPath", obj.getIntrospectionPath()); } - json.put("jwkMaxAgeInSeconds", obj.getJwkMaxAgeInSeconds()); + json.put("jwkMaxAge", obj.getJwkMaxAge()); if (obj.getJwkPath() != null) { json.put("jwkPath", obj.getJwkPath()); } diff --git a/vertx-auth-oauth2/src/main/java/io/vertx/ext/auth/oauth2/OAuth2Options.java b/vertx-auth-oauth2/src/main/java/io/vertx/ext/auth/oauth2/OAuth2Options.java index dab65eca3..d51be2ec1 100644 --- a/vertx-auth-oauth2/src/main/java/io/vertx/ext/auth/oauth2/OAuth2Options.java +++ b/vertx-auth-oauth2/src/main/java/io/vertx/ext/auth/oauth2/OAuth2Options.java @@ -70,7 +70,7 @@ public class OAuth2Options { // JWK path RFC7517 private String jwkPath; //seconds of JWKs lifetime - private long jwkMaxAgeInSeconds; + private long jwkMaxAge; // OpenID non standard private String tenant; @@ -146,7 +146,7 @@ public OAuth2Options(OAuth2Options other) { headers = null; } jwkPath = other.getJwkPath(); - jwkMaxAgeInSeconds = other.getJwkMaxAgeInSeconds(); + jwkMaxAge = other.getJwkMaxAge(); httpClientOptions = other.getHttpClientOptions(); userAgent = other.getUserAgent(); supportedGrantTypes = other.getSupportedGrantTypes(); @@ -163,7 +163,7 @@ private void init() { revocationPath = REVOCATION_PATH; scopeSeparator = SCOPE_SEPARATOR; jwtOptions = JWT_OPTIONS; - jwkMaxAgeInSeconds = JWK_DEFAULT_AGE; + jwkMaxAge = JWK_DEFAULT_AGE; } /** @@ -557,7 +557,7 @@ public OAuth2Options setTenant(String tenant) { @Deprecated public boolean isRotateJWKs() { - return jwkMaxAgeInSeconds != -1L; + return jwkMaxAge != -1L; } /** @@ -565,7 +565,7 @@ public boolean isRotateJWKs() { * * @param rotateJWKs {@code true} to rotate keys as described in {@link OAuth2Auth#jWKSet(Handler)}. * @return self - * @deprecated use {@link #setJwkMaxAgeInSeconds(long)} instead + * @deprecated use {@link #setJwkMaxAge(long)} instead */ @Deprecated public OAuth2Options setRotateJWKs(boolean rotateJWKs) { @@ -703,16 +703,16 @@ public OAuth2Options setHttpClientOptions(HttpClientOptions httpClientOptions) { return this; } - public long getJwkMaxAgeInSeconds() { - return jwkMaxAgeInSeconds; + public long getJwkMaxAge() { + return jwkMaxAge; } /** * -1 means no rotation for JWKs * - * @param jwkMaxAgeInSeconds timeout of JWKs rotation + * @param jwkMaxAge timeout of JWKs rotation */ - public void setJwkMaxAgeInSeconds(long jwkMaxAgeInSeconds) { - this.jwkMaxAgeInSeconds = jwkMaxAgeInSeconds; + public void setJwkMaxAge(long jwkMaxAge) { + this.jwkMaxAge = jwkMaxAge; } } diff --git a/vertx-auth-oauth2/src/main/java/io/vertx/ext/auth/oauth2/impl/OAuth2AuthProviderImpl.java b/vertx-auth-oauth2/src/main/java/io/vertx/ext/auth/oauth2/impl/OAuth2AuthProviderImpl.java index 1c7c52308..6a294e269 100644 --- a/vertx-auth-oauth2/src/main/java/io/vertx/ext/auth/oauth2/impl/OAuth2AuthProviderImpl.java +++ b/vertx-auth-oauth2/src/main/java/io/vertx/ext/auth/oauth2/impl/OAuth2AuthProviderImpl.java @@ -137,7 +137,7 @@ public Future jWKSet() { // ensure that leeway is never negative int leeway = max(0, config.getJWTOptions().getLeeway()); // delay is in ms, while cache max age is sec - final long delay = json.getLong("maxAge", config.getJwkMaxAgeInSeconds()) * 1000 - leeway; + final long delay = json.getLong("maxAge", config.getJwkMaxAge()) * 1000 - leeway; // salesforce (for example) sometimes disables the max-age as setting it to 0 // for these cases we just cancel if (delay > 0) { diff --git a/vertx-auth-webauthn/src/main/generated/io/vertx/ext/auth/webauthn/WebAuthnOptionsConverter.java b/vertx-auth-webauthn/src/main/generated/io/vertx/ext/auth/webauthn/WebAuthnOptionsConverter.java index 614ac8095..26be83d1b 100644 --- a/vertx-auth-webauthn/src/main/generated/io/vertx/ext/auth/webauthn/WebAuthnOptionsConverter.java +++ b/vertx-auth-webauthn/src/main/generated/io/vertx/ext/auth/webauthn/WebAuthnOptionsConverter.java @@ -3,8 +3,7 @@ import io.vertx.core.json.JsonObject; import io.vertx.core.json.JsonArray; import io.vertx.core.json.impl.JsonUtil; -import java.time.Instant; -import java.time.format.DateTimeFormatter; + import java.util.Base64; /** @@ -82,7 +81,7 @@ public static void fromJson(Iterable> json, break; case "timeout": if (member.getValue() instanceof Number) { - obj.setTimeout(((Number)member.getValue()).longValue()); + obj.setTimeoutInMilliseconds(((Number)member.getValue()).longValue()); } break; case "transports": @@ -128,8 +127,8 @@ public static void toJson(WebAuthnOptions obj, java.util.Map jso json.put("relyingParty", obj.getRelyingParty().toJson()); } json.put("requireResidentKey", obj.getRequireResidentKey()); - if (obj.getTimeout() != null) { - json.put("timeout", obj.getTimeout()); + if (obj.getTimeoutInMilliseconds() != null) { + json.put("timeout", obj.getTimeoutInMilliseconds()); } if (obj.getTransports() != null) { JsonArray array = new JsonArray(); diff --git a/vertx-auth-webauthn/src/main/java/io/vertx/ext/auth/webauthn/WebAuthnOptions.java b/vertx-auth-webauthn/src/main/java/io/vertx/ext/auth/webauthn/WebAuthnOptions.java index 8352c134b..eb10f7473 100644 --- a/vertx-auth-webauthn/src/main/java/io/vertx/ext/auth/webauthn/WebAuthnOptions.java +++ b/vertx-auth-webauthn/src/main/java/io/vertx/ext/auth/webauthn/WebAuthnOptions.java @@ -191,7 +191,7 @@ public class WebAuthnOptions { private boolean requireResidentKey; private UserVerification userVerification; - private Long timeout; + private Long timeoutInMilliseconds; private Attestation attestation; // Needs to be a list, order is important @@ -220,7 +220,7 @@ private void init() { extensions = new JsonObject() .put("txAuthSimple", ""); - timeout = 60_000L; + timeoutInMilliseconds = 60_000L; challengeLength = 64; // Support FIDO2 devices, MACOSX, default addPubKeyCredParam(ES256); @@ -361,17 +361,18 @@ public WebAuthnOptions setUserVerification(UserVerification userVerification) { return this; } - public Long getTimeout() { - return timeout; + //ms + public Long getTimeoutInMilliseconds() { + return timeoutInMilliseconds; } - public WebAuthnOptions setTimeout(Long timeout) { - if (timeout != null) { - if (timeout < 0) { + public WebAuthnOptions setTimeoutInMilliseconds(Long timeoutInMilliseconds) { + if (timeoutInMilliseconds != null) { + if (timeoutInMilliseconds < 0) { throw new IllegalArgumentException("Timeout must be >= 0"); } } - this.timeout = timeout; + this.timeoutInMilliseconds = timeoutInMilliseconds; return this; } diff --git a/vertx-auth-webauthn/src/main/java/io/vertx/ext/auth/webauthn/impl/WebAuthnImpl.java b/vertx-auth-webauthn/src/main/java/io/vertx/ext/auth/webauthn/impl/WebAuthnImpl.java index 710cebbf0..61662b5c4 100644 --- a/vertx-auth-webauthn/src/main/java/io/vertx/ext/auth/webauthn/impl/WebAuthnImpl.java +++ b/vertx-auth-webauthn/src/main/java/io/vertx/ext/auth/webauthn/impl/WebAuthnImpl.java @@ -190,7 +190,7 @@ public Future createCredentialsOptions(JsonObject user) { .put("type", "public-key")); } // optional timeout - putOpt(json, "timeout", options.getTimeout()); + putOpt(json, "timeout", options.getTimeoutInMilliseconds()); // optional excluded credentials if (!authenticators.isEmpty()) { JsonArray transports = new JsonArray(); @@ -231,7 +231,7 @@ public Future getCredentialsOptions(String name) { // https://w3c.github.io/webauthn/#dictionary-assertion-options JsonObject json = new JsonObject() .put("challenge", randomBase64URLBuffer(options.getChallengeLength())); - putOpt(json, "timeout", options.getTimeout()); + putOpt(json, "timeout", options.getTimeoutInMilliseconds()); putOpt(json, "rpId", options.getRelyingParty().getId()); putOpt(json, "userVerification", options.getUserVerification()); putOpt(json, "extensions", options.getExtensions()); diff --git a/vertx-auth-webauthn/src/main/java/io/vertx/ext/auth/webauthn/impl/attestation/AndroidSafetynetAttestation.java b/vertx-auth-webauthn/src/main/java/io/vertx/ext/auth/webauthn/impl/attestation/AndroidSafetynetAttestation.java index 298ad64cf..83f9b2105 100644 --- a/vertx-auth-webauthn/src/main/java/io/vertx/ext/auth/webauthn/impl/attestation/AndroidSafetynetAttestation.java +++ b/vertx-auth-webauthn/src/main/java/io/vertx/ext/auth/webauthn/impl/attestation/AndroidSafetynetAttestation.java @@ -99,7 +99,7 @@ public AttestationCertificates validate(WebAuthnOptions options, MetaData metada // 6. Verify the timestamp long timestampMs = token.getJsonObject("payload").getLong("timestampMs", 0L); long now = System.currentTimeMillis(); - if (timestampMs > now || (timestampMs + options.getTimeout()) < now) { + if (timestampMs > now || (timestampMs + options.getTimeoutInMilliseconds()) < now) { throw new AttestationException("timestampMs is invalid!"); } diff --git a/vertx-auth-webauthn/src/test/java/io/vertx/ext/auth/webauthn/impl/attestation/AttestationTest.java b/vertx-auth-webauthn/src/test/java/io/vertx/ext/auth/webauthn/impl/attestation/AttestationTest.java index 5afb77076..11e46606f 100644 --- a/vertx-auth-webauthn/src/test/java/io/vertx/ext/auth/webauthn/impl/attestation/AttestationTest.java +++ b/vertx-auth-webauthn/src/test/java/io/vertx/ext/auth/webauthn/impl/attestation/AttestationTest.java @@ -278,7 +278,7 @@ public void testSafetyNetAttestation(TestContext should) { WebAuthn webAuthN = WebAuthn.create( rule.vertx(), new WebAuthnOptions().setRelyingParty(new RelyingParty().setName("FIDO Examples Corporation")) - .setTimeout(System.currentTimeMillis())) + .setTimeoutInMilliseconds(System.currentTimeMillis())) .authenticatorFetcher(database::fetch) .authenticatorUpdater(database::store); From db45112c3a2a2f800903ed3dc8df1924e8fc1ac9 Mon Sep 17 00:00:00 2001 From: Vorimo Date: Tue, 19 Jul 2022 11:59:39 +0300 Subject: [PATCH 2/2] Review update --- .../io/vertx/ext/auth/JWTOptionsConverter.java | 4 ++-- .../src/main/java/io/vertx/ext/auth/JWTOptions.java | 4 ++-- .../main/java/io/vertx/ext/auth/impl/jose/JWT.java | 4 ++-- .../vertx/ext/auth/test/jwt/JWTAuthProviderTest.java | 4 ++-- .../ext/auth/oauth2/OAuth2OptionsConverter.java | 6 +++--- .../java/io/vertx/ext/auth/oauth2/OAuth2Options.java | 12 ++++++------ .../ext/auth/oauth2/impl/OAuth2AuthProviderImpl.java | 2 +- .../io/vertx/ext/auth/webauthn/WebAuthnOptions.java | 9 ++++----- 8 files changed, 22 insertions(+), 23 deletions(-) diff --git a/vertx-auth-common/src/main/generated/io/vertx/ext/auth/JWTOptionsConverter.java b/vertx-auth-common/src/main/generated/io/vertx/ext/auth/JWTOptionsConverter.java index 27f90db60..617401529 100644 --- a/vertx-auth-common/src/main/generated/io/vertx/ext/auth/JWTOptionsConverter.java +++ b/vertx-auth-common/src/main/generated/io/vertx/ext/auth/JWTOptionsConverter.java @@ -49,7 +49,7 @@ public static void fromJson(Iterable> json, break; case "expiresInSeconds": if (member.getValue() instanceof Number) { - obj.setExpires(((Number)member.getValue()).intValue()); + obj.setExpiresInSeconds(((Number)member.getValue()).intValue()); } break; case "header": @@ -114,7 +114,7 @@ public static void toJson(JWTOptions obj, java.util.Map json) { obj.getAudience().forEach(item -> array.add(item)); json.put("audience", array); } - json.put("expiresInSeconds", obj.getExpires()); + json.put("expiresInSeconds", obj.getExpiresInSeconds()); if (obj.getHeader() != null) { json.put("header", obj.getHeader()); } diff --git a/vertx-auth-common/src/main/java/io/vertx/ext/auth/JWTOptions.java b/vertx-auth-common/src/main/java/io/vertx/ext/auth/JWTOptions.java index 2b7b06ee2..92371e60d 100644 --- a/vertx-auth-common/src/main/java/io/vertx/ext/auth/JWTOptions.java +++ b/vertx-auth-common/src/main/java/io/vertx/ext/auth/JWTOptions.java @@ -96,11 +96,11 @@ public JWTOptions setNoTimestamp(boolean noTimestamp) { return this; } - public int getExpires() { + public int getExpiresInSeconds() { return expires; } - public JWTOptions setExpires(int expires) { + public JWTOptions setExpiresInSeconds(int expires) { this.expires = expires; return this; } diff --git a/vertx-auth-common/src/main/java/io/vertx/ext/auth/impl/jose/JWT.java b/vertx-auth-common/src/main/java/io/vertx/ext/auth/impl/jose/JWT.java index b0f5eebce..b6de32700 100644 --- a/vertx-auth-common/src/main/java/io/vertx/ext/auth/impl/jose/JWT.java +++ b/vertx-auth-common/src/main/java/io/vertx/ext/auth/impl/jose/JWT.java @@ -363,8 +363,8 @@ public String sign(JsonObject payload, JWTOptions options) { payload.put("iat", payload.getValue("iat", timestamp)); } - if (options.getExpires() > 0) { - payload.put("exp", timestamp + options.getExpires()); + if (options.getExpiresInSeconds() > 0) { + payload.put("exp", timestamp + options.getExpiresInSeconds()); } if (options.getAudience() != null && options.getAudience().size() >= 1) { diff --git a/vertx-auth-jwt/src/test/java/io/vertx/ext/auth/test/jwt/JWTAuthProviderTest.java b/vertx-auth-jwt/src/test/java/io/vertx/ext/auth/test/jwt/JWTAuthProviderTest.java index e859039e9..03c44f0fb 100644 --- a/vertx-auth-jwt/src/test/java/io/vertx/ext/auth/test/jwt/JWTAuthProviderTest.java +++ b/vertx-auth-jwt/src/test/java/io/vertx/ext/auth/test/jwt/JWTAuthProviderTest.java @@ -232,7 +232,7 @@ public void testExpiration(TestContext should) { .put("sub", "Paulo"); final String token = authProvider.generateToken(payload, - new JWTOptions().setExpires(1).setNoTimestamp(true)); + new JWTOptions().setExpiresInSeconds(1).setNoTimestamp(true)); should.assertNotNull(token); @@ -628,7 +628,7 @@ public void testValidateTokenWithIgnoreExpired(TestContext should) throws Interr .generateToken( new JsonObject(), new JWTOptions() - .setExpires(1) + .setExpiresInSeconds(1) .setSubject("subject") .setAlgorithm("HS256")); diff --git a/vertx-auth-oauth2/src/main/generated/io/vertx/ext/auth/oauth2/OAuth2OptionsConverter.java b/vertx-auth-oauth2/src/main/generated/io/vertx/ext/auth/oauth2/OAuth2OptionsConverter.java index e4f8ee05c..8f657f679 100644 --- a/vertx-auth-oauth2/src/main/generated/io/vertx/ext/auth/oauth2/OAuth2OptionsConverter.java +++ b/vertx-auth-oauth2/src/main/generated/io/vertx/ext/auth/oauth2/OAuth2OptionsConverter.java @@ -75,9 +75,9 @@ public static void fromJson(Iterable> json, obj.setIntrospectionPath((String)member.getValue()); } break; - case "jwkMaxAge": + case "jwkMaxAgeInSeconds": if (member.getValue() instanceof Number) { - obj.setJwkMaxAge(((Number)member.getValue()).longValue()); + obj.setJwkMaxAgeInSeconds(((Number)member.getValue()).longValue()); } break; case "jwkPath": @@ -207,7 +207,7 @@ public static void toJson(OAuth2Options obj, java.util.Map json) if (obj.getIntrospectionPath() != null) { json.put("introspectionPath", obj.getIntrospectionPath()); } - json.put("jwkMaxAge", obj.getJwkMaxAge()); + json.put("jwkMaxAgeInSeconds", obj.getJwkMaxAgeInSeconds()); if (obj.getJwkPath() != null) { json.put("jwkPath", obj.getJwkPath()); } diff --git a/vertx-auth-oauth2/src/main/java/io/vertx/ext/auth/oauth2/OAuth2Options.java b/vertx-auth-oauth2/src/main/java/io/vertx/ext/auth/oauth2/OAuth2Options.java index d51be2ec1..c6c12593b 100644 --- a/vertx-auth-oauth2/src/main/java/io/vertx/ext/auth/oauth2/OAuth2Options.java +++ b/vertx-auth-oauth2/src/main/java/io/vertx/ext/auth/oauth2/OAuth2Options.java @@ -146,7 +146,7 @@ public OAuth2Options(OAuth2Options other) { headers = null; } jwkPath = other.getJwkPath(); - jwkMaxAge = other.getJwkMaxAge(); + jwkMaxAge = other.getJwkMaxAgeInSeconds(); httpClientOptions = other.getHttpClientOptions(); userAgent = other.getUserAgent(); supportedGrantTypes = other.getSupportedGrantTypes(); @@ -565,7 +565,7 @@ public boolean isRotateJWKs() { * * @param rotateJWKs {@code true} to rotate keys as described in {@link OAuth2Auth#jWKSet(Handler)}. * @return self - * @deprecated use {@link #setJwkMaxAge(long)} instead + * @deprecated use {@link #setJwkMaxAgeInSeconds(long)} instead */ @Deprecated public OAuth2Options setRotateJWKs(boolean rotateJWKs) { @@ -703,16 +703,16 @@ public OAuth2Options setHttpClientOptions(HttpClientOptions httpClientOptions) { return this; } - public long getJwkMaxAge() { + public long getJwkMaxAgeInSeconds() { return jwkMaxAge; } /** * -1 means no rotation for JWKs * - * @param jwkMaxAge timeout of JWKs rotation + * @param jwkMaxAgeInSeconds timeout of JWKs rotation */ - public void setJwkMaxAge(long jwkMaxAge) { - this.jwkMaxAge = jwkMaxAge; + public void setJwkMaxAgeInSeconds(long jwkMaxAgeInSeconds) { + this.jwkMaxAge = jwkMaxAgeInSeconds; } } diff --git a/vertx-auth-oauth2/src/main/java/io/vertx/ext/auth/oauth2/impl/OAuth2AuthProviderImpl.java b/vertx-auth-oauth2/src/main/java/io/vertx/ext/auth/oauth2/impl/OAuth2AuthProviderImpl.java index 6a294e269..1c7c52308 100644 --- a/vertx-auth-oauth2/src/main/java/io/vertx/ext/auth/oauth2/impl/OAuth2AuthProviderImpl.java +++ b/vertx-auth-oauth2/src/main/java/io/vertx/ext/auth/oauth2/impl/OAuth2AuthProviderImpl.java @@ -137,7 +137,7 @@ public Future jWKSet() { // ensure that leeway is never negative int leeway = max(0, config.getJWTOptions().getLeeway()); // delay is in ms, while cache max age is sec - final long delay = json.getLong("maxAge", config.getJwkMaxAge()) * 1000 - leeway; + final long delay = json.getLong("maxAge", config.getJwkMaxAgeInSeconds()) * 1000 - leeway; // salesforce (for example) sometimes disables the max-age as setting it to 0 // for these cases we just cancel if (delay > 0) { diff --git a/vertx-auth-webauthn/src/main/java/io/vertx/ext/auth/webauthn/WebAuthnOptions.java b/vertx-auth-webauthn/src/main/java/io/vertx/ext/auth/webauthn/WebAuthnOptions.java index eb10f7473..c81f5fa5a 100644 --- a/vertx-auth-webauthn/src/main/java/io/vertx/ext/auth/webauthn/WebAuthnOptions.java +++ b/vertx-auth-webauthn/src/main/java/io/vertx/ext/auth/webauthn/WebAuthnOptions.java @@ -191,7 +191,7 @@ public class WebAuthnOptions { private boolean requireResidentKey; private UserVerification userVerification; - private Long timeoutInMilliseconds; + private Long timeout; private Attestation attestation; // Needs to be a list, order is important @@ -220,7 +220,7 @@ private void init() { extensions = new JsonObject() .put("txAuthSimple", ""); - timeoutInMilliseconds = 60_000L; + timeout = 60_000L; challengeLength = 64; // Support FIDO2 devices, MACOSX, default addPubKeyCredParam(ES256); @@ -361,9 +361,8 @@ public WebAuthnOptions setUserVerification(UserVerification userVerification) { return this; } - //ms public Long getTimeoutInMilliseconds() { - return timeoutInMilliseconds; + return timeout; } public WebAuthnOptions setTimeoutInMilliseconds(Long timeoutInMilliseconds) { @@ -372,7 +371,7 @@ public WebAuthnOptions setTimeoutInMilliseconds(Long timeoutInMilliseconds) { throw new IllegalArgumentException("Timeout must be >= 0"); } } - this.timeoutInMilliseconds = timeoutInMilliseconds; + this.timeout = timeoutInMilliseconds; return this; }