diff --git a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2RefreshTokenAuthenticationProvider.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2RefreshTokenAuthenticationProvider.java index 38423c20..56db12a0 100644 --- a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2RefreshTokenAuthenticationProvider.java +++ b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2RefreshTokenAuthenticationProvider.java @@ -120,8 +120,7 @@ public class OAuth2RefreshTokenAuthenticationProvider implements AuthenticationP } OAuth2Authorization.Token refreshToken = authorization.getRefreshToken(); - Instant refreshTokenExpiresAt = refreshToken.getToken().getExpiresAt(); - if (refreshTokenExpiresAt.isBefore(Instant.now())) { + if (!refreshToken.isActive()) { // As per https://tools.ietf.org/html/rfc6749#section-5.2 // invalid_grant: The provided authorization grant (e.g., authorization code, // resource owner credentials) or refresh token is invalid, expired, revoked [...]. @@ -140,10 +139,6 @@ public class OAuth2RefreshTokenAuthenticationProvider implements AuthenticationP scopes = authorizedScopes; } - if (refreshToken.isInvalidated()) { - throw new OAuth2AuthenticationException(new OAuth2Error(OAuth2ErrorCodes.INVALID_GRANT)); - } - String issuer = this.providerSettings != null ? this.providerSettings.issuer() : null; JoseHeader.Builder headersBuilder = JwtUtils.headers();