package io.reactivesw.configuration;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.config.annotation.authentication.builders
    .AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration
    .WebSecurityConfigurerAdapter;

/**
 * Created by umasuo on 17/1/10.
 */
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

  /**
   * configure.
   *
   * @param http HttpSecurity
   * @throws Exception
   */
  @Override
  protected void configure(HttpSecurity http) throws Exception {
    http.authorizeRequests().antMatchers("/**").permitAll();
    http.csrf().disable();
  }

  /**
   * global config.
   *
   * @param auth auth.
   * @throws Exception
   */
  @Autowired
  public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
    auth.inMemoryAuthentication()
        .withUser("user").password("password").roles("USER");
  }
}
@@ -485,16 +485,63 @@
 Adapter;
+%0Aimport org.springframework.web.cors.CorsUtils;
 %0A%0A/**%0A *
@@ -860,49 +860,288 @@
 ts()
-.antMatchers(%22/**%22).permitAll();%0A    http
+%0A        .requestMatchers(CorsUtils::isPreFlightRequest).permitAll()//%E5%B0%B1%E6%98%AF%E8%BF%99%E4%B8%80%E8%A1%8C%E5%95%A6%0A        .antMatchers(%22/**%22).permitAll()%0A//        .antMatchers(%22/admin/**%22).hasRole(%22ADMIN%22)%0A//        .antMatchers(%22/teacher/**%22).hasRole(%22CUSTOMER%22)%0A        .anyRequest().authenticated()%0A        .and()
 .csr

add PreFlightRequest permit