|
@@ -36,6 +36,7 @@ import org.springframework.security.core.Authentication;
|
|
import org.springframework.security.core.AuthenticationException;
|
|
import org.springframework.security.core.AuthenticationException;
|
|
import org.springframework.security.core.session.SessionInformation;
|
|
import org.springframework.security.core.session.SessionInformation;
|
|
import org.springframework.security.core.session.SessionRegistry;
|
|
import org.springframework.security.core.session.SessionRegistry;
|
|
|
|
+import org.springframework.security.oauth2.core.AbstractOAuth2Token;
|
|
import org.springframework.security.oauth2.core.AuthorizationGrantType;
|
|
import org.springframework.security.oauth2.core.AuthorizationGrantType;
|
|
import org.springframework.security.oauth2.core.ClaimAccessor;
|
|
import org.springframework.security.oauth2.core.ClaimAccessor;
|
|
import org.springframework.security.oauth2.core.ClientAuthenticationMethod;
|
|
import org.springframework.security.oauth2.core.ClientAuthenticationMethod;
|
|
@@ -154,12 +155,12 @@ public final class OAuth2AuthorizationCodeAuthenticationProvider implements Auth
|
|
|
|
|
|
if (!authorizationCode.isActive()) {
|
|
if (!authorizationCode.isActive()) {
|
|
if (authorizationCode.isInvalidated()) {
|
|
if (authorizationCode.isInvalidated()) {
|
|
- OAuth2Token token = authorization.getRefreshToken() != null ?
|
|
|
|
- authorization.getRefreshToken().getToken() :
|
|
|
|
- authorization.getAccessToken().getToken();
|
|
|
|
|
|
+ OAuth2Authorization.Token<? extends AbstractOAuth2Token> token = authorization.getRefreshToken() != null ?
|
|
|
|
+ authorization.getRefreshToken() :
|
|
|
|
+ authorization.getAccessToken();
|
|
if (token != null) {
|
|
if (token != null) {
|
|
// Invalidate the access (and refresh) token as the client is attempting to use the authorization code more than once
|
|
// Invalidate the access (and refresh) token as the client is attempting to use the authorization code more than once
|
|
- authorization = OAuth2AuthenticationProviderUtils.invalidate(authorization, token);
|
|
|
|
|
|
+ authorization = OAuth2AuthenticationProviderUtils.invalidate(authorization, token.getToken());
|
|
this.authorizationService.save(authorization);
|
|
this.authorizationService.save(authorization);
|
|
if (this.logger.isWarnEnabled()) {
|
|
if (this.logger.isWarnEnabled()) {
|
|
this.logger.warn(LogMessage.format("Invalidated authorization token(s) previously issued to registered client '%s'", registeredClient.getId()));
|
|
this.logger.warn(LogMessage.format("Invalidated authorization token(s) previously issued to registered client '%s'", registeredClient.getId()));
|