Merge remote-tracking branch 'origin/master'

This commit is contained in:
wangliwen 2022-06-15 14:23:29 +08:00
commit 81d362275a
1 changed files with 4 additions and 0 deletions

View File

@ -6,6 +6,8 @@ import io.renren.common.exception.RenException;
import io.renren.entity.TokenEntity; import io.renren.entity.TokenEntity;
import io.renren.service.TokenService; import io.renren.service.TokenService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.method.HandlerMethod; import org.springframework.web.method.HandlerMethod;
@ -24,10 +26,12 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
private TokenService tokenService; private TokenService tokenService;
public static final String USER_KEY = "userId"; public static final String USER_KEY = "userId";
public static final Logger LOGGER = LoggerFactory.getLogger(AuthorizationInterceptor.class);
@Override @Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
Login annotation; Login annotation;
LOGGER.info("请求地址:{}", request.getRemoteAddr());
if(handler instanceof HandlerMethod) { if(handler instanceof HandlerMethod) {
annotation = ((HandlerMethod) handler).getMethodAnnotation(Login.class); annotation = ((HandlerMethod) handler).getMethodAnnotation(Login.class);
}else{ }else{