title: spring websocket no spring security
body: <p>I used spring websocket by stomp and spring message.
  I don't like using spring security.
  When I use:</p>
  
  <pre><code>SimpMessageSendingOperations.convertAndSendToUser(username,"");
  </code></pre>
  
  <p>I must :</p>
  
  <pre class="lang-java prettyprint-override"><code>@EnableWebSecurity
  @Configuration
  public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
  
      @Override
      protected void configure(HttpSecurity http) throws Exception {
          http
              .csrf().disable()  // Refactor login form
              // See https://jira.springsource.org/browse/SPR-11496
              .headers().addHeaderWriter(
                  new XFrameOptionsHeaderWriter(
                          XFrameOptionsHeaderWriter.XFrameOptionsMode.SAMEORIGIN)).and()
              .formLogin()
                  .defaultSuccessUrl("/index.html")
                  .loginPage("/login.html")
                  .failureUrl("/login.html?error")
                  .permitAll()
                  .and()
              .logout()
                  .logoutSuccessUrl("/")
                  .logoutUrl("/logout.html")
                  .permitAll()
                  .and()
              .authorizeRequests()
                  .antMatchers("/static/**").permitAll()
                  .antMatchers("/webjars/**").permitAll()
                  .anyRequest().authenticated()
                  .and();
      }
  
  
      @Override
      protected void configure(AuthenticationManagerBuilder auth) throws Exception {
          auth
              .inMemoryAuthentication()
                  .withUser("lihui").password("1234").roles("USER").and()
                  .withUser("paulson").password("bond").roles("ADMIN","USER");
      }
  }
  </code></pre>
  
  <p>So, what can I do? Please help.</p>