Skip to content

Commit dd45a49

Browse files
ajavorskidevjzheaux
authored andcommitted
Update JwtTimestampValidator.java
Changed MaxClockSkew variable to clockSkew to simplify the name. Fixes gh-6380
1 parent 4ff5149 commit dd45a49

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

oauth2/oauth2-jose/src/main/java/org/springframework/security/oauth2/jwt/JwtTimestampValidator.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
public final class JwtTimestampValidator implements OAuth2TokenValidator<Jwt> {
4545
private static final Duration DEFAULT_MAX_CLOCK_SKEW = Duration.of(60, ChronoUnit.SECONDS);
4646

47-
private final Duration maxClockSkew;
47+
private final Duration clockSkew;
4848

4949
private Clock clock = Clock.systemUTC();
5050

@@ -55,10 +55,10 @@ public JwtTimestampValidator() {
5555
this(DEFAULT_MAX_CLOCK_SKEW);
5656
}
5757

58-
public JwtTimestampValidator(Duration maxClockSkew) {
59-
Assert.notNull(maxClockSkew, "maxClockSkew cannot be null");
58+
public JwtTimestampValidator(Duration clockSkew) {
59+
Assert.notNull(clockSkew, "clockSkew cannot be null");
6060

61-
this.maxClockSkew = maxClockSkew;
61+
this.clockSkew = clockSkew;
6262
}
6363

6464
/**
@@ -71,7 +71,7 @@ public OAuth2TokenValidatorResult validate(Jwt jwt) {
7171
Instant expiry = jwt.getExpiresAt();
7272

7373
if (expiry != null) {
74-
if (Instant.now(this.clock).minus(maxClockSkew).isAfter(expiry)) {
74+
if (Instant.now(this.clock).minus(clockSkew).isAfter(expiry)) {
7575
OAuth2Error error = new OAuth2Error(
7676
OAuth2ErrorCodes.INVALID_REQUEST,
7777
String.format("Jwt expired at %s", jwt.getExpiresAt()),
@@ -83,7 +83,7 @@ public OAuth2TokenValidatorResult validate(Jwt jwt) {
8383
Instant notBefore = jwt.getNotBefore();
8484

8585
if (notBefore != null) {
86-
if (Instant.now(this.clock).plus(maxClockSkew).isBefore(notBefore)) {
86+
if (Instant.now(this.clock).plus(clockSkew).isBefore(notBefore)) {
8787
OAuth2Error error = new OAuth2Error(
8888
OAuth2ErrorCodes.INVALID_REQUEST,
8989
String.format("Jwt used before %s", jwt.getNotBefore()),

0 commit comments

Comments
 (0)