2016-07-05 76 views
0

試圖讓我的WebSecurityConfigurerAdapter將某些過濾器放置在「/ secured /」上下文中,然後其他URL不在這些過濾器後面。Spring Security WebSecurityConfig需要安全區域和不安全區域

這裏是我到目前爲止,但一切都打到TokenFilter

protected void configure(HttpSecurity http) throws Exception { 
    http.antMatcher("/secured/**").addFilterBefore(new TokenAuthenticationFilter(tokenAuthService, environment), 
      ExceptionTranslationFilter.class). 
      addFilterBefore(new RequestContentBufferFilter(), TokenAuthenticationFilter.class) 
      .antMatcher("/**").anonymous() 
      .and().csrf().disable(); 

} 

任何幫助嗎?

回答

0

我結束了使用WebSecurity範疇內增添端點安全的黑名單忽略這樣的:

public void configure(WebSecurity web) throws Exception { 
    web 
    .ignoring() 
     .antMatchers("/metrics**") 
     .antMatchers("/health**") 
     .antMatchers("/logfile**") 
     .antMatchers("/systemcheck**"); 
}