1、config server引入依赖

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

2、config server配置bootstrap.yml文件

security:
basic:
enabled: true
user:
name: lynch
password: 123456

encrypt:
key-store:
location: configserver.keystore
alias: mydevkey
password: 123456
secret: 123456

3、访问application-prod.properties配置文件

4、config client配置bootstrap.yml文件
4.1、单机配置安全验证

#注意config-client的配置需要放到bootstrap.yml中
management:
security:
enabled: false
spring:
application:
name: mima-cloud-config-client
cloud:
config:
#安全认证设置用户名密码
uri: http://kevin:123456@localhost:6061/
#指定profile,对应mmima-cloud-config-server所获取的配置文件中的{profile}
profile: prod
label: master

eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
instance:
prefer-ip-address: true
instanceId: ${spring.application.name}:${spring.cloud.client.ipAddress}:${server.port}

4.2、集群配置安全验证

#注意config-client的配置需要放到bootstrap.yml中
management:
security:
enabled: false
spring:
application:
name: mima-cloud-config-client
cloud:
consul:
discovery:
instanceId: ${spring.application.name}:${server.port}
host: localhost
port: 8500
config:
enabled: true #false\u7981\u7528Consul\u914d\u7f6e\uff0c\u9ed8\u8ba4true
format: YAML # \u8868\u793aconsul\u4e0a\u9762\u6587\u4ef6\u7684\u683c\u5f0f \u6709\u56db\u79cd YAML PROPERTIES KEY-VALUE FILES
#data-key: configuration #\u8868\u793aconsul\u4e0a\u9762\u7684KEY\u503c(\u6216\u8005\u8bf4\u6587\u4ef6\u7684\u540d\u5b57) \u9ed8\u8ba4\u662fdata
data-key: data #\u8868\u793aconsul\u4e0a\u9762\u7684KEY\u503c(\u6216\u8005\u8bf4\u6587\u4ef6\u7684\u540d\u5b57) \u9ed8\u8ba4\u662fdata
#prefix\u8bbe\u7f6e\u914d\u7f6e\u503c\u7684\u57fa\u672c\u6587\u4ef6\u5939
#defaultContext\u8bbe\u7f6e\u6240\u6709\u5e94\u7528\u7a0b\u5e8f\u4f7f\u7528\u7684\u6587\u4ef6\u5939\u540d\u79f0
#profileSeparator\u8bbe\u7f6e\u7528\u4e8e\u4f7f\u7528\u914d\u7f6e\u6587\u4ef6\u5728\u5c5e\u6027\u6e90\u4e2d\u5206\u9694\u914d\u7f6e\u6587\u4ef6\u540d\u79f0\u7684\u5206\u9694\u7b26\u7684\u503c
config:
profile: prod
label: master
username: lynch
password: 123456
discovery:
# 默认false,设为true表示使用注册中心中的configserver配置而不自己配置configserver的uri
enabled: true
# 指定config server在服务发现中的serviceId,默认为:configserver
serviceId: mima-cloud-config-server

Config安全控制的更多相关文章

  1. Jenkins的安全控制

    在默认配置下,Jenkins是没有安全检查的.任何人都可以以匿名用户身份进入Jenkins,设置Jenkins和Job,执行build操作.但是,Jenkins在大多数应用中,尤其是暴露在互联网的应用 ...

  2. Spring Cloud(Dalston.SR5)--Config 集群配置中心-刷新配置

    远程 SVN 服务器上面的配置修改后,需要通知客户端来改变配置,需要增加 spring-boot-starter-actuator 依赖并将 management.security.enabled 设 ...

  3. SpringCloud全家桶学习之分布式配置中心----Config(七)

    一.概述 (1)背景 微服务意味着将单体应用中的业务拆分成一个个子服务,每个服务的粒度相对较小,因此系统中出现大量的服务.由于每个服务都需要配置必要的配置信息才能运行,所以一套集中式的.动态的配置管理 ...

  4. 一步步开发自己的博客 .NET版(11、Web.config文件的读取和修改)

    Web.config的读取 对于Web.config的读取大家都很属性了.平时我们用得比较多的就是appSettings节点下配置.如: 我们对应的代码是: = ConfigurationManage ...

  5. Discuz NT 架构剖析之Config机制

    接触了Discuz NT! 一段时间了,是时候做个总结了,标题好霸气,有木有? 都是托园子里的大牛代振军的福啊,哈哈哈哈. 首先论坛的信息不是完全存储在数据库里面的,一部分信息存储在config文件里 ...

  6. [笔记]HAproxy reload config file with uninterrupt session

    HAProxy is a high performance load balancer. It is very light-weight, and free, making it a great op ...

  7. MyBatis2:config.xml文件

    前言 前一篇文章,讲了MyBatis入门,讲到了MyBatis有两个基本的配置文件,一个用来配置环境信息,一个用来写SQL语句.前者我把它命名为config.xml,config.xml的内容是: & ...

  8. 搞了我一下午竟然是web.config少写了一个点

    Safari手机版居然有个这么愚蠢的bug,浪费了我整个下午,使尽浑身解数,国内国外网站搜索解决方案,每一行代码读了又想想了又读如此不知道多少遍,想破脑袋也想不通到底哪里出了问题,结果竟然是web.c ...

  9. WCF中,通过C#代码或App.config配置文件创建ServiceHost类

    C# static void Main(string[] args) { //创建宿主的基地址 Uri baseAddress = new Uri("http://localhost:808 ...

随机推荐

  1. 如何快速求解第一类斯特林数--nlog^2n + nlogn

    目录 参考资料 前言 暴力 nlog^2n的做法 nlogn的做法 代码 参考资料 百度百科 斯特林数 学习笔记-by zhouzhendong 前言 首先是因为这道题,才去研究了这个玩意:[2019 ...

  2. [JZOJ3615]【NOI2014模拟】数列(平面几何+二维线段树)

    Description 给定一个长度为n的正整数数列a[i]. 定义2个位置的f值为两者位置差与数值差的和,即f(x,y)=|x-y|+|a[x]-a[y]|. 你需要写一个程序支持2种操作(k都是正 ...

  3. ES6学习

    一.ES6的特点 1.let(变量),const(常量) 2.在ES6中不能重复定义 3.块级作用域 普通作用域 if(true){ var test =1; } console.log(test); ...

  4. linux configure 应用

    linux下configure命令详细介绍 2018年01月11日 15:02:20 冷月霜 阅读数:705 标签: configure 更多 个人分类: 数据库技术   Linux环境下的软件安装, ...

  5. mac搭建简单的hls推流服务器遇到的问题(待更新)

    实际操作步骤: 输入brew install nginx-full --with-rtmp-module命令出现以下报错: 需要先安装nginx服务器,运行命令brew tap homebrew/ng ...

  6. 关于A2C算法

    https://github.com/sweetice/Deep-reinforcement-learning-with-pytorch/blob/master/Char4%20A2C/A2C.py ...

  7. hbase数据原理及基本架构

    第一:hbase介绍 hbase是一个构建在hdfs上的分布式列存储系统: hbase是apache hadoop生态系统中的重要一员,主要用于海量结构化数据存储 从逻辑上讲,hbase将数据按照表. ...

  8. jsp 表单回显

    1.在表单各个字段中添加value属性,如:value="${user.reloginpass }" 2.在表单提交对应的servlet中封装数据到uer中,如:req.setAt ...

  9. Python的变量声明

    Python 与大多数其它语言一样有局部变量和全局变量之分,但是它没有明显的变量声明.变量通过首次赋值产生,当超出作用范围时自动消亡. Example 1. 定义 myParams 变量 if __n ...

  10. [Swift]LeetCode220. 存在重复元素 III | Contains Duplicate III

    Given an array of integers, find out whether there are two distinct indices i and j in the array suc ...