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

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

package love.keeping.starter.web.config;

import love.keeping.starter.web.components.security.LoginInterceptor;
import love.keeping.starter.web.components.security.PermitAllService;
import love.keeping.starter.web.components.tenant.DefaultTenantInterceptor;
import love.keeping.starter.web.components.tenant.TenantInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
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 SecurityAutoConfiguration implements WebMvcConfigurer {

  @Autowired
  private PermitAllService permitAllService;

  @Autowired
  private TenantInterceptor tenantInterceptor;

  @Bean
  @ConditionalOnProperty(prefix = "keeping.tenant", value = "enabled", havingValue = "false")
  public TenantInterceptor tenantInterceptor() {
    return new DefaultTenantInterceptor();
  }

  @Override
  public void addInterceptors(InterceptorRegistry registry) {

    registry.addInterceptor(new LoginInterceptor(permitAllService));
    registry.addInterceptor(tenantInterceptor);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy