Nacos开启鉴权配置(Spring Cloud+Nacos)
本文使用场景是Nacos开启单例模式下,在已有Java项目服务中,更换为鉴权模式的流程。主要流程分为两步:
1、开启Nacos鉴权模式
首先需要找到Nacos文件下的conf—application.properties
Nacos配置文件找到如下配置并且修改为以下内容
### If turn on auth system:(是否开启鉴权,这里选择开启)
nacos.core.auth.system.type=nacos
nacos.core.auth.enabled=true
...
在2.2.0.1版本后,社区发布版本将移除以文档如下值作为默认值,需要自行填充,否则无法启动节点
### The two properties is the white list for auth and used by identity the request from other server.(自定义key/value)
nacos.core.auth.server.identity.key=example
nacos.core.auth.server.identity.value=example
...
自定义密钥时,推荐将配置项设置为Base64编码的字符串