首页 > 其他分享 >IllegalStateException: For MAC signing you do not need to specify the verifier key separately异常解决

IllegalStateException: For MAC signing you do not need to specify the verifier key separately异常解决

时间:2022-12-23 14:34:33浏览次数:48  
标签:do signing exception springframework verifier key org


IllegalStateException: For MAC signing you do not need to specify the verifier key separately...

一.异常现象

我在SpringCloud微服务项目中,利用SpringSecurity整合OAuth2,结合RSA非对称加密算法实现jwt token的时候,遇到了如下异常信息:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfiguration': Unsatisfied dependency expressed through field 'tokenStore'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tokenStore' defined in class path resource ....: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.provider.token.TokenStore]: Factory method 'tokenStore' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accessTokenConverter' defined in class path resource ... Invocation of init method failed; nested exception is java.lang.IllegalStateException: For MAC signing you do not need to specify the verifier key separately, and if you do it must match the signing key
.....
Caused by: java.lang.IllegalStateException: For MAC signing you do not need to specify the verifier key separately, and if you do it must match the signing key
at org.springframework.util.Assert.state(Assert.java:73) ~[spring-core-5.0.11.RELEASE.jar:5.0.11.RELEASE]
at ....

二.异常原因

出现这个问题的原因,一般都是因为自己的RSA公钥文件写错了!

比如我一开始利用keytool工具导出的公钥,然后把公钥复制粘贴到自己的public.txt文件中,结果少粘贴了3个“---”,就导致了该问题的产生!如下图标红区域所示:

IllegalStateException: For MAC signing you do not need to specify the verifier key separately异常解决_微服务

三.解决办法

一定要确保自己的public.txt公钥文件格式和内容正确!从keytool中导出的时候仔细点就好了!

IllegalStateException: For MAC signing you do not need to specify the verifier key separately异常解决_java_02

 

 

标签:do,signing,exception,springframework,verifier,key,org
From: https://blog.51cto.com/u_7044146/5965622

相关文章