package com.ruoyi.framework.interceptor.cas;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Configuration;

import net.unicon.cas.client.configuration.CasClientConfigurerAdapter;
import net.unicon.cas.client.configuration.EnableCasClient;

/**
 * TODO $CAS统一认证：拦截器类CAS
 */
//@EnableCasClient
//@Configuration
public class CasConfigure extends CasClientConfigurerAdapter {
    @Override
    public void configureAuthenticationFilter(FilterRegistrationBean authenticationFilter) {

        super.configureAuthenticationFilter(authenticationFilter);
//        authenticationFilter.addInitParameter("ignorePattern", "/Content/*|/context/*|/actuator/*|/assets/*|/instances/*");
//        authenticationFilter.addInitParameter("ignorePattern", "/Content/*|/context/*|/actuator/*|/assets/*|/instances/*|login/*|/loginv2/*|/captchaImage/*");
//              "|/captchaImage/*|/system/*|/common/*|/monitor/*|/register/*|/login/*|/getInfo/*|/getRouters/*|/test/user/*|/tool/gen/*|/postcheck/login|/redirectpostcheck");
        authenticationFilter.addInitParameter("ignorePattern", "/Content/*|/context/*|/actuator/*|/assets/*|/instances/*" +
                "|/postCheck/*|/captchaImage/*|/system/*|/common/*|/monitor/*|/register/*|/login/*|/logout/*|/getInfo/*|/getRouters/*|/test/user/*|/tool/gen/*|/postcheck/login|/redirectpostcheck|/redirectpostcheckout"+
                "|/avatar/*|/swagger-ui/*");
        authenticationFilter.getInitParameters().put("authenticationRedirectStrategyClass", "com.patterncat.CustomAuthRedirectStrategy");
    }
}
