Skip to content

Commit aa1ef46

Browse files
qavideleftherias
authored andcommitted
Update clockSkew javadoc according to implementation
Closes gh-10174
1 parent 16a2126 commit aa1ef46

File tree

2 files changed

+26
-14
lines changed

2 files changed

+26
-14
lines changed

oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/OAuth2AuthorizedClientProviderBuilder.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -204,10 +204,12 @@ public PasswordGrantBuilder accessTokenResponseClient(
204204

205205
/**
206206
* Sets the maximum acceptable clock skew, which is used when checking the access
207-
* token expiry. An access token is considered expired if it's before
208-
* {@code Instant.now(this.clock) - clockSkew}.
207+
* token expiry. An access token is considered expired if
208+
* {@code OAuth2Token#getExpiresAt() - clockSkew} is before the current time
209+
* {@code clock#instant()}.
209210
* @param clockSkew the maximum acceptable clock skew
210211
* @return the {@link PasswordGrantBuilder}
212+
* @see PasswordOAuth2AuthorizedClientProvider#setClockSkew(Duration)
211213
*/
212214
public PasswordGrantBuilder clockSkew(Duration clockSkew) {
213215
this.clockSkew = clockSkew;
@@ -275,10 +277,12 @@ public ClientCredentialsGrantBuilder accessTokenResponseClient(
275277

276278
/**
277279
* Sets the maximum acceptable clock skew, which is used when checking the access
278-
* token expiry. An access token is considered expired if it's before
279-
* {@code Instant.now(this.clock) - clockSkew}.
280+
* token expiry. An access token is considered expired if
281+
* {@code OAuth2Token#getExpiresAt() - clockSkew} is before the current time
282+
* {@code clock#instant()}.
280283
* @param clockSkew the maximum acceptable clock skew
281284
* @return the {@link ClientCredentialsGrantBuilder}
285+
* @see ClientCredentialsOAuth2AuthorizedClientProvider#setClockSkew(Duration)
282286
*/
283287
public ClientCredentialsGrantBuilder clockSkew(Duration clockSkew) {
284288
this.clockSkew = clockSkew;
@@ -365,10 +369,12 @@ public RefreshTokenGrantBuilder accessTokenResponseClient(
365369

366370
/**
367371
* Sets the maximum acceptable clock skew, which is used when checking the access
368-
* token expiry. An access token is considered expired if it's before
369-
* {@code Instant.now(this.clock) - clockSkew}.
372+
* token expiry. An access token is considered expired if
373+
* {@code OAuth2Token#getExpiresAt() - clockSkew} is before the current time
374+
* {@code clock#instant()}.
370375
* @param clockSkew the maximum acceptable clock skew
371376
* @return the {@link RefreshTokenGrantBuilder}
377+
* @see RefreshTokenOAuth2AuthorizedClientProvider#setClockSkew(Duration)
372378
*/
373379
public RefreshTokenGrantBuilder clockSkew(Duration clockSkew) {
374380
this.clockSkew = clockSkew;

oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/ReactiveOAuth2AuthorizedClientProviderBuilder.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -225,10 +225,12 @@ public ClientCredentialsGrantBuilder accessTokenResponseClient(
225225

226226
/**
227227
* Sets the maximum acceptable clock skew, which is used when checking the access
228-
* token expiry. An access token is considered expired if it's before
229-
* {@code Instant.now(this.clock) - clockSkew}.
228+
* token expiry. An access token is considered expired if
229+
* {@code OAuth2Token#getExpiresAt() - clockSkew} is before the current time
230+
* {@code clock#instant()}.
230231
* @param clockSkew the maximum acceptable clock skew
231232
* @return the {@link ClientCredentialsGrantBuilder}
233+
* @see ClientCredentialsReactiveOAuth2AuthorizedClientProvider#setClockSkew(Duration)
232234
*/
233235
public ClientCredentialsGrantBuilder clockSkew(Duration clockSkew) {
234236
this.clockSkew = clockSkew;
@@ -297,10 +299,12 @@ public PasswordGrantBuilder accessTokenResponseClient(
297299

298300
/**
299301
* Sets the maximum acceptable clock skew, which is used when checking the access
300-
* token expiry. An access token is considered expired if it's before
301-
* {@code Instant.now(this.clock) - clockSkew}.
302+
* token expiry. An access token is considered expired if
303+
* {@code OAuth2Token#getExpiresAt() - clockSkew} is before the current time
304+
* {@code clock#instant()}.
302305
* @param clockSkew the maximum acceptable clock skew
303306
* @return the {@link PasswordGrantBuilder}
307+
* @see PasswordReactiveOAuth2AuthorizedClientProvider#setClockSkew(Duration)
304308
*/
305309
public PasswordGrantBuilder clockSkew(Duration clockSkew) {
306310
this.clockSkew = clockSkew;
@@ -368,10 +372,12 @@ public RefreshTokenGrantBuilder accessTokenResponseClient(
368372

369373
/**
370374
* Sets the maximum acceptable clock skew, which is used when checking the access
371-
* token expiry. An access token is considered expired if it's before
372-
* {@code Instant.now(this.clock) - clockSkew}.
375+
* token expiry. An access token is considered expired if
376+
* {@code OAuth2Token#getExpiresAt() - clockSkew} is before the current time
377+
* {@code clock#instant()}.
373378
* @param clockSkew the maximum acceptable clock skew
374379
* @return the {@link RefreshTokenGrantBuilder}
380+
* @see RefreshTokenReactiveOAuth2AuthorizedClientProvider#setClockSkew(Duration)
375381
*/
376382
public RefreshTokenGrantBuilder clockSkew(Duration clockSkew) {
377383
this.clockSkew = clockSkew;

0 commit comments

Comments
 (0)