Eureka 添加安全认证

2017-12-12  本文已影响0人  吕志豪

一、添加spring-security支持

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

二、在配置文件中加入安全认证

# 安全认证的配置  
security:  
  basic:  
    enabled: true  
  user:  
    name: chhliu  # 用户名  
    password: chhliu123456   # 用户密码  
eureka:  
  client:  
    register-with-eureka: false  
    fetch-registry: false  
    service-url:  
      defaultZone: http://chhliu:chhliu123456@localhost:8761/eureka  # 安全的注册地址  
上一篇 下一篇

猜你喜欢

热点阅读