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..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 @@ -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; /** 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..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 @@ -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; @@ -97,16 +97,16 @@ public JWTOptions setNoTimestamp(boolean noTimestamp) { } public int getExpiresInSeconds() { - return expiresInSeconds; + return expires; } - public JWTOptions setExpiresInSeconds(int expiresInSeconds) { - this.expiresInSeconds = expiresInSeconds; + public JWTOptions setExpiresInSeconds(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-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..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 @@ -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.getJwkMaxAgeInSeconds(); 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; } /** @@ -704,7 +704,7 @@ public OAuth2Options setHttpClientOptions(HttpClientOptions httpClientOptions) { } public long getJwkMaxAgeInSeconds() { - return jwkMaxAgeInSeconds; + return jwkMaxAge; } /** @@ -713,6 +713,6 @@ public long getJwkMaxAgeInSeconds() { * @param jwkMaxAgeInSeconds timeout of JWKs rotation */ public void setJwkMaxAgeInSeconds(long jwkMaxAgeInSeconds) { - this.jwkMaxAgeInSeconds = jwkMaxAgeInSeconds; + this.jwkMaxAge = jwkMaxAgeInSeconds; } } 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..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 @@ -361,17 +361,17 @@ public WebAuthnOptions setUserVerification(UserVerification userVerification) { return this; } - public Long getTimeout() { + public Long getTimeoutInMilliseconds() { return timeout; } - 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.timeout = 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);