Skip to content

Commit db45112

Browse files
committed
Review update
1 parent 2e09ae9 commit db45112

File tree

8 files changed

+22
-23
lines changed

8 files changed

+22
-23
lines changed

vertx-auth-common/src/main/generated/io/vertx/ext/auth/JWTOptionsConverter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json,
4949
break;
5050
case "expiresInSeconds":
5151
if (member.getValue() instanceof Number) {
52-
obj.setExpires(((Number)member.getValue()).intValue());
52+
obj.setExpiresInSeconds(((Number)member.getValue()).intValue());
5353
}
5454
break;
5555
case "header":
@@ -114,7 +114,7 @@ public static void toJson(JWTOptions obj, java.util.Map<String, Object> json) {
114114
obj.getAudience().forEach(item -> array.add(item));
115115
json.put("audience", array);
116116
}
117-
json.put("expiresInSeconds", obj.getExpires());
117+
json.put("expiresInSeconds", obj.getExpiresInSeconds());
118118
if (obj.getHeader() != null) {
119119
json.put("header", obj.getHeader());
120120
}

vertx-auth-common/src/main/java/io/vertx/ext/auth/JWTOptions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ public JWTOptions setNoTimestamp(boolean noTimestamp) {
9696
return this;
9797
}
9898

99-
public int getExpires() {
99+
public int getExpiresInSeconds() {
100100
return expires;
101101
}
102102

103-
public JWTOptions setExpires(int expires) {
103+
public JWTOptions setExpiresInSeconds(int expires) {
104104
this.expires = expires;
105105
return this;
106106
}

vertx-auth-common/src/main/java/io/vertx/ext/auth/impl/jose/JWT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,8 @@ public String sign(JsonObject payload, JWTOptions options) {
363363
payload.put("iat", payload.getValue("iat", timestamp));
364364
}
365365

366-
if (options.getExpires() > 0) {
367-
payload.put("exp", timestamp + options.getExpires());
366+
if (options.getExpiresInSeconds() > 0) {
367+
payload.put("exp", timestamp + options.getExpiresInSeconds());
368368
}
369369

370370
if (options.getAudience() != null && options.getAudience().size() >= 1) {

vertx-auth-jwt/src/test/java/io/vertx/ext/auth/test/jwt/JWTAuthProviderTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ public void testExpiration(TestContext should) {
232232
.put("sub", "Paulo");
233233

234234
final String token = authProvider.generateToken(payload,
235-
new JWTOptions().setExpires(1).setNoTimestamp(true));
235+
new JWTOptions().setExpiresInSeconds(1).setNoTimestamp(true));
236236

237237
should.assertNotNull(token);
238238

@@ -628,7 +628,7 @@ public void testValidateTokenWithIgnoreExpired(TestContext should) throws Interr
628628
.generateToken(
629629
new JsonObject(),
630630
new JWTOptions()
631-
.setExpires(1)
631+
.setExpiresInSeconds(1)
632632
.setSubject("subject")
633633
.setAlgorithm("HS256"));
634634

vertx-auth-oauth2/src/main/generated/io/vertx/ext/auth/oauth2/OAuth2OptionsConverter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ public static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json,
7575
obj.setIntrospectionPath((String)member.getValue());
7676
}
7777
break;
78-
case "jwkMaxAge":
78+
case "jwkMaxAgeInSeconds":
7979
if (member.getValue() instanceof Number) {
80-
obj.setJwkMaxAge(((Number)member.getValue()).longValue());
80+
obj.setJwkMaxAgeInSeconds(((Number)member.getValue()).longValue());
8181
}
8282
break;
8383
case "jwkPath":
@@ -207,7 +207,7 @@ public static void toJson(OAuth2Options obj, java.util.Map<String, Object> json)
207207
if (obj.getIntrospectionPath() != null) {
208208
json.put("introspectionPath", obj.getIntrospectionPath());
209209
}
210-
json.put("jwkMaxAge", obj.getJwkMaxAge());
210+
json.put("jwkMaxAgeInSeconds", obj.getJwkMaxAgeInSeconds());
211211
if (obj.getJwkPath() != null) {
212212
json.put("jwkPath", obj.getJwkPath());
213213
}

vertx-auth-oauth2/src/main/java/io/vertx/ext/auth/oauth2/OAuth2Options.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public OAuth2Options(OAuth2Options other) {
146146
headers = null;
147147
}
148148
jwkPath = other.getJwkPath();
149-
jwkMaxAge = other.getJwkMaxAge();
149+
jwkMaxAge = other.getJwkMaxAgeInSeconds();
150150
httpClientOptions = other.getHttpClientOptions();
151151
userAgent = other.getUserAgent();
152152
supportedGrantTypes = other.getSupportedGrantTypes();
@@ -565,7 +565,7 @@ public boolean isRotateJWKs() {
565565
*
566566
* @param rotateJWKs {@code true} to rotate keys as described in {@link OAuth2Auth#jWKSet(Handler)}.
567567
* @return self
568-
* @deprecated use {@link #setJwkMaxAge(long)} instead
568+
* @deprecated use {@link #setJwkMaxAgeInSeconds(long)} instead
569569
*/
570570
@Deprecated
571571
public OAuth2Options setRotateJWKs(boolean rotateJWKs) {
@@ -703,16 +703,16 @@ public OAuth2Options setHttpClientOptions(HttpClientOptions httpClientOptions) {
703703
return this;
704704
}
705705

706-
public long getJwkMaxAge() {
706+
public long getJwkMaxAgeInSeconds() {
707707
return jwkMaxAge;
708708
}
709709

710710
/**
711711
* -1 means no rotation for JWKs
712712
*
713-
* @param jwkMaxAge timeout of JWKs rotation
713+
* @param jwkMaxAgeInSeconds timeout of JWKs rotation
714714
*/
715-
public void setJwkMaxAge(long jwkMaxAge) {
716-
this.jwkMaxAge = jwkMaxAge;
715+
public void setJwkMaxAgeInSeconds(long jwkMaxAgeInSeconds) {
716+
this.jwkMaxAge = jwkMaxAgeInSeconds;
717717
}
718718
}

vertx-auth-oauth2/src/main/java/io/vertx/ext/auth/oauth2/impl/OAuth2AuthProviderImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public Future<Void> jWKSet() {
137137
// ensure that leeway is never negative
138138
int leeway = max(0, config.getJWTOptions().getLeeway());
139139
// delay is in ms, while cache max age is sec
140-
final long delay = json.getLong("maxAge", config.getJwkMaxAge()) * 1000 - leeway;
140+
final long delay = json.getLong("maxAge", config.getJwkMaxAgeInSeconds()) * 1000 - leeway;
141141
// salesforce (for example) sometimes disables the max-age as setting it to 0
142142
// for these cases we just cancel
143143
if (delay > 0) {

vertx-auth-webauthn/src/main/java/io/vertx/ext/auth/webauthn/WebAuthnOptions.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ public class WebAuthnOptions {
191191
private boolean requireResidentKey;
192192
private UserVerification userVerification;
193193

194-
private Long timeoutInMilliseconds;
194+
private Long timeout;
195195
private Attestation attestation;
196196

197197
// Needs to be a list, order is important
@@ -220,7 +220,7 @@ private void init() {
220220
extensions = new JsonObject()
221221
.put("txAuthSimple", "");
222222

223-
timeoutInMilliseconds = 60_000L;
223+
timeout = 60_000L;
224224
challengeLength = 64;
225225
// Support FIDO2 devices, MACOSX, default
226226
addPubKeyCredParam(ES256);
@@ -361,9 +361,8 @@ public WebAuthnOptions setUserVerification(UserVerification userVerification) {
361361
return this;
362362
}
363363

364-
//ms
365364
public Long getTimeoutInMilliseconds() {
366-
return timeoutInMilliseconds;
365+
return timeout;
367366
}
368367

369368
public WebAuthnOptions setTimeoutInMilliseconds(Long timeoutInMilliseconds) {
@@ -372,7 +371,7 @@ public WebAuthnOptions setTimeoutInMilliseconds(Long timeoutInMilliseconds) {
372371
throw new IllegalArgumentException("Timeout must be >= 0");
373372
}
374373
}
375-
this.timeoutInMilliseconds = timeoutInMilliseconds;
374+
this.timeout = timeoutInMilliseconds;
376375
return this;
377376
}
378377

0 commit comments

Comments
 (0)