Commit f519f5452572198ff86110a2a44a0a01fdaa7704

Authored by 郑超
1 parent e7a89da6

update

src/main/java/com/cnlive/shenhe/ShenheApplication.java
... ... @@ -31,21 +31,13 @@ public class ShenheApplication extends SpringBootServletInitializer {
31 31 private static final String CAS_SERVER_URL_PREFIX = "https://user.cnlive.com/OpenSSO2";
32 32 private static final String CAS_SERVER_LOGIN_URL = "https://user.cnlive.com/OpenSSO2/login";
33 33 //本机的名称
34   - private static final String SERVER_NAME = "http://test.shen.cnlive.com:82";
  34 + private static final String SERVER_NAME = "http://shen.cnlive.com:81";
35 35  
36 36 //登录入口
37   - private static final String SERVICE_LOGIN = "http://test.shen.cnlive.com:82/users/login";
  37 + private static final String SERVICE_LOGIN = "http://shen.cnlive.com:81/users/login";
38 38  
39 39 //登出
40   - private static final String SERVICE_LOGINOUT = "http://test.shen.cnlive.com:82/users/logout";
41   -
42   - public static void main(String[] args) {
43   -// SpringApplication.run(ShenheApplication.class, args);
44   - SpringApplicationBuilder builder = new SpringApplicationBuilder(ShenheApplication.class);
45   - builder.headless(true).run(args);
46   - // 设置Headless模式,linux系统下
47   - System.setProperty("java.awt.headless", "true");
48   - }
  40 + private static final String SERVICE_LOGINOUT = "http://shen.cnlive.com:81/users/logout";
49 41  
50 42  
51 43 /**
... ... @@ -145,6 +137,124 @@ public class ShenheApplication extends SpringBootServletInitializer {
145 137 return registration;
146 138 }
147 139  
  140 +
  141 + /**
  142 + * 登录过滤器
  143 + * @return
  144 + */
  145 + /* @Bean
  146 + public FilterRegistrationBean filterSingleRegistration() {
  147 + FilterRegistrationBean registration = new FilterRegistrationBean();
  148 + registration.setFilter(new SingleSignOutFilter());
  149 + // 设定匹配的路径
  150 + registration.addUrlPatterns("/*");
  151 + Map<String,String> initParameters = new HashMap<String, String>();
  152 + initParameters.put("casServerUrlPrefix", CAS_SERVER_URL_PREFIX);
  153 + registration.setInitParameters(initParameters);
  154 + // 设定加载的顺序
  155 + registration.setOrder(1);
  156 + return registration;
  157 + }
  158 +
  159 + *//**
  160 + * 过滤验证器
  161 + * @return
  162 + *//*
  163 + @Bean
  164 + public FilterRegistrationBean filterValidationRegistration() {
  165 + FilterRegistrationBean registration = new FilterRegistrationBean();
  166 + registration.setFilter(new Cas30ProxyReceivingTicketValidationFilter());
  167 + // 设定匹配的路径
  168 + registration.addUrlPatterns("/*");
  169 + Map<String,String> initParameters = new HashMap<String, String>();
  170 + initParameters.put("casServerUrlPrefix", CAS_SERVER_URL_PREFIX);
  171 + initParameters.put("serverName", SERVER_NAME);
  172 + initParameters.put("useSession", "true");
  173 + registration.setInitParameters(initParameters);
  174 + // 设定加载的顺序
  175 + registration.setOrder(1);
  176 + return registration;
  177 + }
  178 +
  179 + *//**
  180 + * 授权过滤器
  181 + * @return
  182 + *//*
  183 + *//*@Bean
  184 + public FilterRegistrationBean filterAuthenticationRegistration() {
  185 + FilterRegistrationBean registration = new FilterRegistrationBean();
  186 + registration.setFilter(new AuthenticationFilter());
  187 + // 设定匹配的路径
  188 + registration.addUrlPatterns("/*");
  189 + Map<String,String> initParameters = new HashMap<String, String>();
  190 + initParameters.put("casServerLoginUrl", CAS_SERVER_URL_PREFIX);
  191 + initParameters.put("server", SERVICE_LOGIN);
  192 +
  193 + //initParameters.put("ignorePattern", ".*");
  194 + //表示过滤所有
  195 + //initParameters.put("ignoreUrlPatternType", "com.cnlive.shenhe.config.SimpleUrlPatternMatcherStrategy");
  196 +
  197 + registration.setInitParameters(initParameters);
  198 + // 设定加载的顺序
  199 + registration.setOrder(1);
  200 + return registration;
  201 + }*//*
  202 +
  203 + *//**
  204 + * wraper过滤器
  205 + * @return
  206 + *//*
  207 + @Bean
  208 + public FilterRegistrationBean filterWrapperRegistration() {
  209 + FilterRegistrationBean registration = new FilterRegistrationBean();
  210 + registration.setFilter(new HttpServletRequestWrapperFilter());
  211 + // 设定匹配的路径
  212 + registration.addUrlPatterns("/*");
  213 + // 设定加载的顺序
  214 + registration.setOrder(1);
  215 + return registration;
  216 + }
  217 +
  218 + *//**
  219 + * 添加监听器
  220 + * @return
  221 + *//*
  222 + @Bean
  223 + public ServletListenerRegistrationBean<EventListener> singleSignOutListenerRegistration(){
  224 + ServletListenerRegistrationBean<EventListener> registrationBean = new ServletListenerRegistrationBean<EventListener>();
  225 + registrationBean.setListener(new SingleSignOutHttpSessionListener());
  226 + registrationBean.setOrder(1);
  227 + return registrationBean;
  228 + }
  229 +
  230 + */
  231 +
  232 + /**
  233 + * 设定首页
  234 + *//*
  235 + @Configuration
  236 + public class DefaultView extends WebMvcConfigurerAdapter {
  237 +
  238 + @Override
  239 + public void addViewControllers(ViewControllerRegistry registry) {
  240 + //设定首页为index
  241 + registry.addViewController("/").setViewName("forward:/users/index");
  242 +
  243 + //设定匹配的优先级
  244 + registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
  245 +
  246 + //添加视图控制类
  247 + super.addViewControllers(registry);
  248 + }
  249 + }*/
  250 + public static void main(String[] args) {
  251 +// SpringApplication.run(ShenheApplication.class, args);
  252 + SpringApplicationBuilder builder = new SpringApplicationBuilder(ShenheApplication.class);
  253 + builder.headless(true).run(args);
  254 + // 设置Headless模式,linux系统下
  255 + System.setProperty("java.awt.headless", "true");
  256 + }
  257 +
148 258 /**
149 259 * 配置内部类
150 260 */
... ...