zoukankan      html  css  js  c++  java
  • eureka服务端添加security验证之后,client注册失败

    问题:erueka服务端添加security验证之后,client注册失败:

      com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server

    解决:

    在eureke服务端添加配置:

    @Configuration
    @EnableWebSecurity
    public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
    // Configure HttpSecurity as needed (e.g. enable http basic).
    http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.NEVER);
    http.csrf().disable();
    //注意:为了可以使用 http://${user}:${password}@${host}:${port}/eureka/ 这种方式登录,所以必须是httpBasic,
    // 如果是form方式,不能使用url格式登录
    http.authorizeRequests().anyRequest().authenticated().and().httpBasic();

    }
    }

    spring boot 使用
    Security:

    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-security</artifactId>
    </dependency>

    参考https://blog.csdn.net/qq_33802316/article/details/80677644

  • 相关阅读:
    ORM补充文件
    auth.User.groups: (fields.E304) Reverse accessor for 'User.groups'
    JS BOM和DOM
    ctrl+shift+上箭头 改变代码位置
    盒子半透明
    多背景颜色写图片后面
    心跳
    动画
    仿站小工具哈哈哈
    旋转案例
  • 原文地址:https://www.cnblogs.com/Mr-xt/p/10220806.html
Copyright © 2011-2022 走看看