浏览代码

Polish gh-161

Joe Grandja 4 年之前
父节点
当前提交
4688b0f879

+ 1 - 6
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<OAuth2RefreshToken> 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();