Remove expiresAt constructor-arg in OAuth2RefreshToken
Fixes gh-5854
This commit is contained in:
@@ -38,9 +38,8 @@ public class OAuth2RefreshToken extends AbstractOAuth2Token {
|
||||
*
|
||||
* @param tokenValue the token value
|
||||
* @param issuedAt the time at which the token was issued
|
||||
* @param expiresAt the expiration time on or after which the token MUST NOT be accepted
|
||||
*/
|
||||
public OAuth2RefreshToken(String tokenValue, Instant issuedAt, Instant expiresAt) {
|
||||
super(tokenValue, issuedAt, expiresAt);
|
||||
public OAuth2RefreshToken(String tokenValue, Instant issuedAt) {
|
||||
super(tokenValue, issuedAt, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,12 +189,7 @@ public final class OAuth2AccessTokenResponse {
|
||||
accessTokenResponse.accessToken = new OAuth2AccessToken(
|
||||
this.tokenType, this.tokenValue, issuedAt, expiresAt, this.scopes);
|
||||
if (StringUtils.hasText(this.refreshToken)) {
|
||||
// The Access Token response does not return an expires_in for the Refresh Token,
|
||||
// therefore, we'll default to +1 second from issuedAt time.
|
||||
// NOTE:
|
||||
// The expiry or invalidity of a Refresh Token can only be determined by performing
|
||||
// the refresh_token grant and if it fails than likely it has expired or has been invalidated.
|
||||
accessTokenResponse.refreshToken = new OAuth2RefreshToken(this.refreshToken, issuedAt, issuedAt.plusSeconds(1));
|
||||
accessTokenResponse.refreshToken = new OAuth2RefreshToken(this.refreshToken, issuedAt);
|
||||
}
|
||||
accessTokenResponse.additionalParameters = Collections.unmodifiableMap(
|
||||
CollectionUtils.isEmpty(this.additionalParameters) ? Collections.emptyMap() : this.additionalParameters);
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.springframework.security.oauth2.core;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
|
||||
/**
|
||||
@@ -25,7 +24,6 @@ import java.time.Instant;
|
||||
*/
|
||||
public class TestOAuth2RefreshTokens {
|
||||
public static OAuth2RefreshToken refreshToken() {
|
||||
return new OAuth2RefreshToken("refresh-token", Instant.now(),
|
||||
Instant.now().plus(Duration.ofDays(1)));
|
||||
return new OAuth2RefreshToken("refresh-token", Instant.now());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user