diff --git a/blade-core-boot/src/main/java/org/springblade/core/boot/resolver/TokenArgumentResolver.java b/blade-core-boot/src/main/java/org/springblade/core/boot/resolver/TokenArgumentResolver.java index 49535ec..5907b70 100644 --- a/blade-core-boot/src/main/java/org/springblade/core/boot/resolver/TokenArgumentResolver.java +++ b/blade-core-boot/src/main/java/org/springblade/core/boot/resolver/TokenArgumentResolver.java @@ -24,8 +24,6 @@ import org.springframework.web.context.request.NativeWebRequest; import org.springframework.web.method.support.HandlerMethodArgumentResolver; import org.springframework.web.method.support.ModelAndViewContainer; -import javax.servlet.http.HttpServletRequest; - /** * Token转化BladeUser */ @@ -56,8 +54,7 @@ public class TokenArgumentResolver implements HandlerMethodArgumentResolver { ModelAndViewContainer modelAndViewContainer, NativeWebRequest nativeWebRequest, WebDataBinderFactory webDataBinderFactory) { - HttpServletRequest request = nativeWebRequest.getNativeRequest(HttpServletRequest.class); - return SecureUtil.getUser(request); + return SecureUtil.getUser(); } } diff --git a/blade-core-secure/src/main/java/org/springblade/core/secure/utils/SecureUtil.java b/blade-core-secure/src/main/java/org/springblade/core/secure/utils/SecureUtil.java index cc7d53c..aec3e16 100644 --- a/blade-core-secure/src/main/java/org/springblade/core/secure/utils/SecureUtil.java +++ b/blade-core-secure/src/main/java/org/springblade/core/secure/utils/SecureUtil.java @@ -75,7 +75,7 @@ public class SecureUtil { public static BladeUser getUser(HttpServletRequest request) { Claims claims = getClaims(request); if (claims == null) { - return new BladeUser(); + return null; } Integer userId = Func.toInt(claims.get(SecureUtil.userId)); String roleId = Func.toStr(claims.get(SecureUtil.roleId));