2016-12-20 4 views
0

私はスプリングウェブスレッドをストンプとスプリングメッセージで使いました。 私は春のセキュリティを使用して好きではありません。 私が使用:スプリングウェブソケットなしスプリングセキュリティ

SimpMessageSendingOperations.convertAndSendToUser(username,""); 

私がしなければならない:

@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"); 
    } 
} 

だから、私は何ができるのでしょうか?助けてください。

+0

それはあなたがこのことについて何を好きではないですか?この問題は私には分かりません。 Spring Securityを使用して設定する必要があります。また、WebSocketを使用してユーザーに送信することは、Spring Securityに依存していないので、ここで問題が何であるかを再度確認する必要はありません。 –

+0

私は春のwebsocketと春のセキュリティなしでストンプを使用したい。 –

答えて

0

//when i not useing spring security.i can used 
 
simpMessageSendingOperations.convertAndSendTo(usename,"queue/"+usename+"/greating",object); 
 
//and client like this: 
 
stompClient.subscribe('/queue/'++usename+'greetings', function (greeting) { 
 
     showGreeting(JSON.parse(greeting.body).content); 
 
    });

関連する問題