package com.ruoyi.auth.config;

//import com.ruoyi.common.core.utils.StringUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.core.env.Environment;
//import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
//import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
//import org.springframework.security.web.SecurityFilterChain;

/**
 * @ClassName ActuatorSecurityConfig
 * @Author YaphetS
 * @Date 2023/3/14 9:18
 * @Version 1.0
 * @Description TODO
 */
//@Configuration
//@EnableWebSecurity
//@EnableGlobalMethodSecurity(prePostEnabled = true)
public class ActuatorSecurityConfig {

//    @Autowired
//    Environment env;
//
//    @Bean
//    public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
//        String contextPath = env.getProperty("management.endpoints.web.base-path");
//        if(StringUtils.isEmpty(contextPath)) {
//            contextPath = "/actuator";
//        }
//        http.csrf().disable();
//        http.authorizeRequests()
//            .antMatchers("/**"+contextPath+"/**")
//            .authenticated()
//            .anyRequest()
//            .permitAll()
//            .and()
//            .httpBasic();
//        return http.build();
//    }
}
