Commit 2f2fae1b authored by 严俊's avatar 严俊

验证token调整

parent bd1dae51
package com.afanticar.afantiopenapi.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import java.util.Set;
@Data
@Configuration
@ConfigurationProperties(prefix = "ignored")
public class IgnoredUri {
private Set<String> uris;
}
......@@ -33,7 +33,6 @@ import java.util.concurrent.TimeUnit;
@Slf4j
@Setter
@Component
@ConfigurationProperties(prefix = "ignored")
public class TokenInterceptor implements HandlerInterceptor {
@Autowired
......@@ -42,13 +41,14 @@ public class TokenInterceptor implements HandlerInterceptor {
@Autowired
RedissonClient redissonClient;
private Set<String> uris;
@Autowired
private IgnoredUri ignoredUri;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
String requestUri = request.getRequestURI();
log.info("请求uri" + requestUri);
if (uris.contains(requestUri)) {
if (ignoredUri.getUris().contains(requestUri)) {
return true;
}
String token = request.getHeader("authorization");
......
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