|
|
@ -40,6 +40,7 @@ import org.springframework.scheduling.annotation.Scheduled; |
|
|
|
import org.springframework.security.authentication.AuthenticationCredentialsNotFoundException; |
|
|
|
import org.springframework.security.authentication.AuthenticationCredentialsNotFoundException; |
|
|
|
import org.springframework.security.core.AuthenticationException; |
|
|
|
import org.springframework.security.core.AuthenticationException; |
|
|
|
import org.springframework.security.oauth2.common.exceptions.InvalidClientException; |
|
|
|
import org.springframework.security.oauth2.common.exceptions.InvalidClientException; |
|
|
|
|
|
|
|
import org.springframework.security.oauth2.common.exceptions.InvalidScopeException; |
|
|
|
import org.springframework.security.oauth2.common.exceptions.InvalidTokenException; |
|
|
|
import org.springframework.security.oauth2.common.exceptions.InvalidTokenException; |
|
|
|
import org.springframework.security.oauth2.provider.AuthorizationRequest; |
|
|
|
import org.springframework.security.oauth2.provider.AuthorizationRequest; |
|
|
|
import org.springframework.security.oauth2.provider.OAuth2Authentication; |
|
|
|
import org.springframework.security.oauth2.provider.OAuth2Authentication; |
|
|
@ -198,9 +199,9 @@ public class DefaultOAuth2ProviderTokenService implements OAuth2TokenEntityServi |
|
|
|
// set the scope of the new access token if requested
|
|
|
|
// set the scope of the new access token if requested
|
|
|
|
token.setScope(scope); |
|
|
|
token.setScope(scope); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// up-scoping is not allowed
|
|
|
|
String errorMsg = "Up-scoping is not allowed."; |
|
|
|
// (TODO: should this throw InvalidScopeException? For now just pass through)
|
|
|
|
logger.error(errorMsg); |
|
|
|
token.setScope(refreshScopes); |
|
|
|
throw new InvalidScopeException(errorMsg); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// otherwise inherit the scope of the refresh token (if it's there -- this can return a null scope set)
|
|
|
|
// otherwise inherit the scope of the refresh token (if it's there -- this can return a null scope set)
|
|
|
|