|
@@ -58,7 +58,7 @@ public class RedisTokenValidator implements OAuth2TokenValidator<Jwt> {
|
|
|
);
|
|
|
return OAuth2TokenValidatorResult.success();
|
|
|
}
|
|
|
- String scope = ObjectUtils.size(values) > 0 ? (String) values.get(0) : null;
|
|
|
+ String scope = ObjectUtils.size(values) > 0 ? (String) StringUtils.ifEmpty(values.get(0), (String) null) : null;
|
|
|
String token = ObjectUtils.size(values) > 1 ? (String) values.get(1) : null;
|
|
|
if (StringUtils.isEmpty(token)) {
|
|
|
throw new OAuth2AuthenticationException(new OAuth2Error(
|
|
@@ -69,11 +69,11 @@ public class RedisTokenValidator implements OAuth2TokenValidator<Jwt> {
|
|
|
throw new OAuth2AuthenticationException(new OAuth2Error(
|
|
|
"TOKEN_CHANGED", ApplicationContextHolder.getMessage("Token.Changed"), null
|
|
|
));
|
|
|
- } else if (!Objects.equals(scope, String.valueOf(OAuthContextHolder.getScope(jwt)))) {
|
|
|
+ } else if (!Objects.equals(scope, OAuthContextHolder.getScope(jwt))) {
|
|
|
// 判断应用范围是否相同,如果不同则表示应用范围已被重置,需要刷新令牌
|
|
|
- String message = ApplicationContextHolder.getMessage(
|
|
|
- "Scope.Changed", new Object[]{ApplicationContextHolder.getMessage(String.valueOf(scope))}
|
|
|
- );
|
|
|
+ String arg = StringUtils.isEmpty(scope) ? StringUtils.EMPTY :
|
|
|
+ ApplicationContextHolder.getMessage(scope);
|
|
|
+ String message = ApplicationContextHolder.getMessage("Scope.Changed", new Object[]{arg});
|
|
|
throw new OAuth2AuthenticationException(new OAuth2Error("SCOPE_CHANGED", message, null));
|
|
|
}
|
|
|
|