package com.zsElectric.boot.config;

import com.zsElectric.boot.common.util.SecurityUtils;
import com.zsElectric.boot.config.property.SecurityFilterProperties;
import jakarta.annotation.PostConstruct;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;

/**
 * 安全工具类配置
 * <p>
 * 用于初始化安全工具类的相关配置
 *
 * @author zsElectric
 */
@Slf4j
@Configuration
@RequiredArgsConstructor
public class SecurityUtilsConfig {

    private final SecurityFilterProperties securityFilterProperties;

    @PostConstruct
    public void init() {
        // 设置 SQL 注入检测模式
        SecurityUtils.setSqlStrictMode(securityFilterProperties.getSqlStrictMode());
        log.info("安全工具类初始化完成，SQL 注入检测模式: {}", 
                securityFilterProperties.getSqlStrictMode() ? "严格模式" : "宽松模式");
    }
}
