Nacos 2.2.1 启动报错

目录

1、报错情况

2、报错原因

3、解决方法


1、报错情况

Caused by: java.lang.IllegalArgumentException: The specified key byte array is 192 bits which is not secure enough for any JWT HMAC-SHA algorithm.  The JWT JWA Specification (RFC 7518, Section 3.2) states that keys used with HMAC-SHA algorithms MUST have a size >= 256 bits (the key size must be greater than or equal to the hash output size).  See https://tools.ietf.org/html/rfc7518#section-3.2 for more information.
        at com.alibaba.nacos.plugin.auth.impl.jwt.NacosJwtParser.<init>(NacosJwtParser.java:56)
        at com.alibaba.nacos.plugin.auth.impl.token.impl.JwtTokenManager.processProperties(JwtTokenManager.java:71)

2、报错原因

跟据报错情况分析,是因为指定的密钥字节数组是0位,这对于任何JWT HMAC-SHA算法来说都不够安全。JWT JWA规范(RFC 7518,第3.2节)规定,与HMAC-SHA算法一起使用的密钥必须具有>=256位(也就是32字节)的大小(密钥大小必须大于或等于哈希输出大小)。

3、解决方法

修改配置文件conf/application.propertise的nacos.core.auth.plugin.nacos.token.secret.key选项

添加大于32个字节的任意字符

nacos.core.auth.plugin.nacos.token.secret.key=qwe1rty2ui3opl4kjh5gf6dsazx7cvbnm

配置完后,重启服务就可以正常启动。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值