alibaba / nacos

an easy-to-use dynamic service discovery, configuration and service management platform for building cloud native applications.
https://nacos.io
Apache License 2.0
30.07k stars 12.81k forks source link

naco1.2.0 增加登录验证配置后,客户端注册不上去。报错403 #2484

Closed lixiaolin2018 closed 4 years ago

lixiaolin2018 commented 4 years ago

sprinspring版本2.2.5

0.2.2.RELEASE spring-cloud-dependencies Hoxton.RELEASE [2020-03-16 17:51:24.526] [ERROR] [ThreadPoolTaskScheduler-1] [uin:] [traceId:] [org.springframework.cloud.alibaba.nacos.discovery.NacosWatch] [NacosWatch.java:171] Error watching Nacos Service change java.lang.IllegalStateException: failed to req API:/nacos/v1/ns/service/list after all servers([192.168.8.90:32628]) tried: failed to req API:http://192.168.8.90:32628/nacos/v1/ns/service/list. code:403 msg:

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Mon Mar 16 17:52:30 GMT+08:00 2020
There was an unexpected error (type=Forbidden, status=403).
unknown user!
lixiaolin2018 commented 4 years ago

nacos server版本是1.2.0 springcloud是Hoxton.RELEASE. 在nacos中将nacos.core.auth.enabled=true开启后,我的服务注册不到nacos里,如果设置成false是没问题的,文档里需要配置username、password,但在application.yml里是找不到这两个配置属性。是不是springcloud Hoxton还没有支持最新的nacos1.2.0的版本,我想使用其中的权限功能

kinkocho commented 4 years ago

我也碰到了同样的问题。按照Nacos 1.2.0 权限控制介绍和使用上面描述的初始化后,还是报同样的错误,不知道是不是实现方式哪个地方有遗漏。。

lixiaolin2018 commented 4 years ago

按照Nacos 1.2.0权限控制介绍和使用上面描述的初始化后,还是报同样的错误,不知道是不是实现方式其中地方有遗漏。。

我初始化时没有userName和password两个属性

kinkocho commented 4 years ago

是这两个属性没有吗? // 配置用户名: properties.put(PropertyKeyConst.USERNAME, "user1"); // 配置密码: properties.put(PropertyKeyConst.PASSWORD, "pwd1"); nacos-client的版本要升级到1.2.0,先把spring-cloud依赖里面的nacos-client exclude掉,然后再单独引入1.2.0版本的依赖。

kinkocho commented 4 years ago

建议作者:spring-cloud-alibaba-config和nacos-discovery-spring-boot-autoconfigure 也同步做些升级吧。

chuntaojun commented 4 years ago

Issue moved to alibaba/spring-cloud-alibaba #1269 via ZenHub

chuntaojun commented 4 years ago

This function has been adapted. We are waiting for the release of spring cloud alibaba