更新 :POC可以在这里找到https://github.com/kakawait/uaa-behind-zuul-
sample
您是否尝试过以下设置(在
zuul服务器上):
zuul: routes: uaa-service: path: /uaa/** stripPrefix: falsesecurity: # Disable Spring Boot basic authentication basic: enabled: false oauth2: sso: loginPath: /login client: accessTokenUri: https://<zuul hostname>/uaa/oauth/token userAuthorizationUri: https://<zuul hostname>/uaa/oauth/authorize ...
基本上,它对我的项目有效,我要做的就是禁用路由
CSRF保护
/uaa/oauth/token。
验证服务器应处于开启状态
server: # Use different context-path to avoid session cookie overlapping context-path: /uaa
经过测试
Spring-Cloud.Brixton.M3
感谢@ thomas-letsch,您应该像下面那样调整安全性(示例)
public void configure(HttpSecurity http) throws Exception { http.logout().and() .antMatcher("/**").authorizeRequests() .antMatchers("/index.html", "/home.html", "/", "/uaa/oauth/**").permitAll() .anyRequest().authenticated().and() .csrf().csrfTokenRepository(getCSRFTokenRepository()).ignoringAntMatchers("/uaa/oauth/token").and() .addFilterAfter(createCSRFHeaderFilter(), CsrfFilter.class); }


