Commit 84edc424 authored by 严俊's avatar 严俊

Merge branch 'dev-activity-faw' of...

Merge branch 'dev-activity-faw' of http://gitlab.afanticar.com:13140/java-ms/afanti-open-api into develop
parents c5975f1d 83a4423d
...@@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -31,15 +32,14 @@ import java.util.concurrent.TimeUnit; ...@@ -31,15 +32,14 @@ import java.util.concurrent.TimeUnit;
* @since 2023/4/26/026 * @since 2023/4/26/026
*/ */
@Slf4j @Slf4j
@Setter
@Component @Component
public class TokenInterceptor implements HandlerInterceptor { public class TokenInterceptor extends HandlerInterceptorAdapter {
@Autowired @Autowired
private AfantiCasFeign casFeign; private AfantiCasFeign casFeign;
@Autowired @Autowired
RedissonClient redissonClient; private RedissonClient redissonClient;
@Autowired @Autowired
private IgnoredUri ignoredUri; private IgnoredUri ignoredUri;
......
package com.afanticar.afantiopenapi.config; package com.afanticar.afantiopenapi.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
...@@ -14,12 +15,17 @@ import javax.annotation.Resource; ...@@ -14,12 +15,17 @@ import javax.annotation.Resource;
@Configuration @Configuration
public class WebMvcConfig implements WebMvcConfigurer { public class WebMvcConfig implements WebMvcConfigurer {
@Resource // @Resource
TokenInterceptor tokenInterceptor; // TokenInterceptor tokenInterceptor;
@Bean
public TokenInterceptor getLoginInterceptor(){
return new TokenInterceptor();
}
@Override @Override
public void addInterceptors(InterceptorRegistry register) { public void addInterceptors(InterceptorRegistry register) {
register.addInterceptor(tokenInterceptor); register.addInterceptor(getLoginInterceptor());
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment