All Downloads are FREE. Search and download functionalities are using the official Maven repository.

love.keeping.starter.web.config.WebMvcAutoConfiguration Maven / Gradle / Ivy

The newest version!
package love.keeping.starter.web.config;

import cn.dev33.satoken.interceptor.SaAnnotationInterceptor;
import love.keeping.starter.web.components.security.PermitAllService;
import java.util.Map.Entry;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMvcAutoConfiguration implements WebMvcConfigurer {

  @Autowired
  private PermitAllService permitAllService;

  @Override
  public void addInterceptors(InterceptorRegistry registry) {

    registry.addInterceptor(new SaAnnotationInterceptor()).addPathPatterns("/**")
        .excludePathPatterns(
            permitAllService.getUrls().stream().map(Entry::getValue).collect(Collectors.toList()));
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy