package com.ygtx.framework.config.security;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

/**
 * ICE SSO安全配置
 * 
 * @author ruoyi
 */
@Configuration
public class IceSsoSecurityConfig
{
    /**
     * 配置RestTemplate Bean，用于ICE SSO通信
     * 
     * @return RestTemplate实例
     */
    @Bean("iceSsoRestTemplate")
    public RestTemplate iceSsoRestTemplate()
    {
        SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
        // 设置连接超时时间
        factory.setConnectTimeout(30000); // 30秒
        // 设置读取超时时间
        factory.setReadTimeout(30000); // 30秒
        
        RestTemplate restTemplate = new RestTemplate(factory);
        return restTemplate;
    }
}