Spring Cloud Eureka 全解 (8)

本文基于SpringCloud-Dalston.SR5

一般的,Eureka在内网服务,我们不会对于外网暴露Eureka端口,所以一般Eureka不做任何验证。假设我们想进一步增强Eureka的安全性,可以结合spring security来简单配置一些安全设置

首先在Spring Cloud Eureka Server所在的项目中添加对于spring security的依赖:

1<dependency> 2 <groupId>org.springframework.boot</groupId> 3 <artifactId>spring-boot-starter-security</artifactId> 4</dependency>

然后在项目配置文件application.properties中加入安全认证,注意三点配置,用户名,密码,还有Eureka服务地址:

1#打开security 2security.basic.enabled=true 3security.user.name=username 4security.user.password=password 5 6#这里的用户名密码就是上面配置的 7eureka.client.service-url.defaultZone=http://username:password@localhost:8761/eureka # 安全的注册地址
点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

手写Java HashMap源码

HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22

Spring Cloud Eureka 全解 (7)

本文基于SpringCloudDalston.SR5(https://www.oschina.net/action/GoToLink?urlhttp%3A%2F%2Fcloud.spring.io%2Fspringcloudstatic%2FDalston.SR5%2F)可以实现比较快的服务上下线:EurekaServer配置:

Spring Cloud Eureka 全解 (5)

本文基于SpringCloudDalston.SR5(https://www.oschina.net/action/GoToLink?urlhttp%3A%2F%2Fcloud.spring.io%2Fspringcloudstatic%2FDalston.SR5%2F)自我保护机制关闭自我保护机制(默认是打开的):eu

Spring Cloud Eureka 全解 (6)

本文基于SpringCloudDalston.SR5(https://www.oschina.net/action/GoToLink?urlhttp%3A%2F%2Fcloud.spring.io%2Fspringcloudstatic%2FDalston.SR5%2F)Eureka服务实例启动时,是否会立刻向EurekaServer注册?