From 4688b0f8795b77d328b2b2a81ae24a86a063e4c9 Mon Sep 17 00:00:00 2001 From: Joe Grandja Date: Thu, 3 Jun 2021 09:43:10 -0400 Subject: [PATCH] Polish gh-161 --- .../OAuth2RefreshTokenAuthenticationProvider.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) 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();