package myfeed.router; import org.springframework.boot.SpringApplication; import org.springframework.cloud.client.SpringCloudApplication; import org.springframework.cloud.netflix.zuul.EnableZuulProxy; //import org.springframework.cloud.security.oauth2.sso.EnableOAuth2Sso; //import org.springframework.cloud.security.oauth2.sso.OAuth2SsoConfigurerAdapter; /** * @author Spencer Gibb */ @SpringCloudApplication @EnableZuulProxy //@EnableOAuth2Sso //@EnableRedisHttpSession public class RouterApp { public static void main(String[] args) { SpringApplication.run(RouterApp.class, args); } /* @Configuration protected static class SecurityConfiguration extends OAuth2SsoConfigurerAdapter { @Override public void match(RequestMatchers matchers) { matchers.anyRequest(); } @Override public void configure(HttpSecurity http) throws Exception { http.authorizeRequests() .antMatchers("/").permitAll().anyRequest() .authenticated().and().csrf() .csrfTokenRepository(csrfTokenRepository()).and() .addFilterAfter(csrfHeaderFilter(), CsrfFilter.class); } private Filter csrfHeaderFilter() { return new OncePerRequestFilter() { @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { CsrfToken csrf = (CsrfToken) request.getAttribute(CsrfToken.class .getName()); if (csrf != null) { Cookie cookie = WebUtils.getCookie(request, "XSRF-TOKEN"); String token = csrf.getToken(); if (cookie==null || token!=null && !token.equals(cookie.getValue())) { cookie = new Cookie("XSRF-TOKEN", token); cookie.setPath("/"); response.addCookie(cookie); } } filterChain.doFilter(request, response); } }; } private CsrfTokenRepository csrfTokenRepository() { HttpSessionCsrfTokenRepository repository = new HttpSessionCsrfTokenRepository(); repository.setHeaderName("X-XSRF-TOKEN"); return repository; } }*/ }