|
|
@@ -1,10 +1,7 @@
|
|
|
package cn.reghao.dfs.store.inerceptor;
|
|
|
|
|
|
import cn.reghao.dfs.store.util.UserContext;
|
|
|
-import cn.reghao.tnb.account.api.dto.AccountInfo;
|
|
|
-import cn.reghao.tnb.account.api.iface.JwtService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import javax.servlet.*;
|
|
|
@@ -17,10 +14,7 @@ import java.io.IOException;
|
|
|
*/
|
|
|
@Slf4j
|
|
|
@Component
|
|
|
-public class JwtTokenFilter implements Filter {
|
|
|
- @DubboReference(check = false)
|
|
|
- private JwtService jwtService;
|
|
|
-
|
|
|
+public class TokenFilter implements Filter {
|
|
|
@Override
|
|
|
public void init(FilterConfig filterConfig) throws ServletException {
|
|
|
}
|
|
|
@@ -32,15 +26,6 @@ public class JwtTokenFilter implements Filter {
|
|
|
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
|
|
|
String auth = httpServletRequest.getHeader("Authorization");
|
|
|
if (auth != null) {
|
|
|
- String jwt = auth.replace("Bearer ", "");
|
|
|
- try {
|
|
|
- AccountInfo accountInfo = jwtService.getAccountInfo(jwt);
|
|
|
- if (accountInfo != null) {
|
|
|
- userId = accountInfo.getUserId();
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- log.error(e.getMessage());
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
try (UserContext context = new UserContext(userId)) {
|