【问题标题】:Eureka Server using Spring Cloud Finchley RC1使用 Spring Cloud Finchley RC1 的 Eureka 服务器
【发布时间】:2018-10-18 09:11:46
【问题描述】:

带有 Spring Cloud Finchley.RC1 的 Eureka 使用基于表单的身份验证,导致 eureka 客户端无法使用:

eureka:
  client:
    serviceUrl:
      defaultZone: http://user:password@localhost:8761/eureka

知道如何取回 Spring Cloud Egware.SR3 中使用的原始身份验证机制吗?

在这里我创建了一个示例 repo:

https://github.com/altfatterz/eureka

【问题讨论】:

    标签: spring-security spring-cloud netflix-eureka


    【解决方案1】:

    和这个问题一样:https://github.com/spring-cloud/spring-cloud-netflix/issues/2754

    Ryan Baxter 建议的解决方法是禁用 csrf

    http.csrf().disable()
    

    我通过将这个 WebSecurityConfig 包含在 eureka 服务中来使其工作。

    @EnableWebSecurity
    public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.csrf().disable()
                .authorizeRequests()
                    .anyRequest().authenticated()
                .and()
                    .httpBasic();
       }
    }
    

    【讨论】:

      猜你喜欢
      • 2018-04-29
      • 2015-04-11
      • 2016-02-15
      • 2018-01-18
      • 2018-04-15
      • 2019-02-11
      • 2018-04-24
      • 1970-01-01
      • 2015-07-20
      相关资源
      最近更新 更多