2016-10-24 70 views

回答

0

配置Spring Security以強制執行/hystrix端點的基本身份驗證。例如:

@Configuration 
public class SecurityConfiguration extends WebSecurityConfigurerAdapter { 

    @Override 
    protected void configure(final HttpSecurity http) throws Exception { 
     http.httpBasic() 
      .and() 
      .authorizeRequests() 
      .antMatchers("/hystrix") 
      .authenticated();  
    } 
} 
+0

我已經加入。當我提供證書時,它與url localhost:8080/hystrix一起工作。但是,一旦我輸入「/hystrix.stream」並點擊「監視器」,它也會進行身份驗證。基本上,它會在儀表板屏幕上進行所有請求(AJAX調用)的驗證,以便無法提供信用。我的服務是STATELESS。 –

+0

這隻驗證「/ hystrix」。如果您像這樣配置安全性,則Stream端點不需要身份驗證。 –

+0

它不適用於以下安全配置。 。而()。sessionManagement()。sessionCreationPolicy(SessionCreationPolicy.STATELESS) –

相關問題