//package com.dxhy.admin.sys.config;
//
//import org.springframework.beans.factory.DisposableBean;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
//import org.springframework.boot.web.servlet.FilterRegistrationBean;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//import com.xxl.sso.core.conf.Conf;
//import com.xxl.sso.core.filter.XxlSsoWebFilter;
//import com.xxl.sso.core.store.SsoLoginStore;
//import com.xxl.sso.core.util.JedisUtil;
//
//import lombok.extern.slf4j.Slf4j;
//
///**
// * @author xuxueli 2018-11-15
// */
//@Configuration
//@Slf4j
//@ConditionalOnProperty(name = "dxhy.sso.open", havingValue = "true")
//public class DxhySsoConfig implements DisposableBean {
//
//    @Value("${dxhy.sso.server}")
//    private String xxlSsoServer;
//
//    @Value("${dxhy.sso.logout.path}")
//    private String xxlSsoLogoutPath;
//
//    @Value("${dxhy-sso.excluded.paths}")
//    private String xxlSsoExcludedPaths;
//
//    @Value("${dxhy.sso.redis.address}")
//    private String xxlSsoRedisAddress;
//    @Value("${dxhy.sso.redis.password}")
//    private String redisPassword;
//    @Value("${dxhy.sso.redirect_url}")
//    private String redirectUrl;
//    @Value("${dxhy.sso.redis.expireminite}")
//    private int redisExpireMinite;
//
//    @Bean
//    public FilterRegistrationBean xxlSsoFilterRegistration() {
//
//        // xxl-sso, redis init
//        JedisUtil.init(xxlSsoRedisAddress, redisPassword);
//        SsoLoginStore.setRedisExpireMinite(redisExpireMinite);
//        // xxl-sso, filter init
//        FilterRegistrationBean registration = new FilterRegistrationBean();
//
//        registration.setName("XxlSsoWebFilter");
//        registration.setOrder(1);
//        registration.addUrlPatterns("/*");
//        registration.setFilter(new XxlSsoWebFilter());
//        registration.addInitParameter(Conf.SSO_SERVER, xxlSsoServer);
//        registration.addInitParameter(Conf.SSO_LOGOUT_PATH, xxlSsoLogoutPath);
//        registration.addInitParameter(Conf.SSO_EXCLUDED_PATHS, xxlSsoExcludedPaths);
//        registration.addInitParameter(Conf.REDIRECT_URL, redirectUrl);
//        return registration;
//    }
//
//    @Override
//    public void destroy() throws Exception {
//
//        // xxl-sso, redis close
//        JedisUtil.close();
//    }
//
//}
