package com.jiayue.ipp.common.security.authorize;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 管理security配置
 *
 *
 */
@Component
public class SysAuthorizeConfigurerManager  {

    @Autowired
    List<AuthorizeConfigurerProvider> authorizeConfigurerProviders;

    // 将一个个AuthorizeConfigurerProvider的实现类，传入配置的参数 ExpressionInterceptUrlRegistry
    public void configure(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry config) {
        for(AuthorizeConfigurerProvider provider: authorizeConfigurerProviders) {
            provider.confiure(config);
        }
    }
}
