本地一切正常!
但是,在raspberrypi上部署到我的Kubernetes k3s集群之后,该集群可以通过https域进行访问,令牌功能的oauth2代码交换不起作用。我目前支持通过Google和GitHub进行身份验证,而这两个都有此问题。以下是日志:
GitHub登录失败:
org.springframework.security.oauth2.core.OAuth2AuthenticationException:
[invalid_token_response] An error occurred while attempting to retrieve the OAuth 2.0 Access Token Response: Error while extracting response for type [class org.springframework.security.oauth2.core.endpoint.OAuth2AccessTokenResponse] and content type [application/json;charset=utf-8];
nested exception is org.springframework.http.converter.HttpMessageNotReadableException: An error occurred reading the OAuth 2.0 Access Token Response: tokenValue cannot be empty;
nested exception is java.lang.IllegalArgumentException: tokenValue cannot be empty
Google登录失败:
org.springframework.security.oauth2.core.OAuth2AuthenticationException:
[invalid_token_response] An error occurred while attempting to retrieve the OAuth 2.0 Access Token Response: I/O error on POST request for "https://www.googleapis.com/oauth2/v4/token": Invalid ECDH ServerKeyExchange signature;
nested exception is javax.net.ssl.SSLHandshakeException: Invalid ECDH ServerKeyExchange signature
我已经尝试过的:
我认为从myKubernetes群集中发送https请求可能是一个问题,但是我连接到正在运行的Pod并卷曲https://google.com,效果很好。
你们有没有遇到过这样的问题?
@ edit我正在使用Java 11
@ edit2我的raaspberrypi上的docker似乎有问题。卷曲https请求可以正常工作,但是在Java中使用RestTemplate
不起作用
@ edit3找到一个相关的问题https://github.com/docker-library/tomcat/issues/182
假设您在本地和Kubernetes上使用完全相同的容器/可执行文件/库,并且根据您共享的错误消息,最可能的原因是本地环境和Kubernetes环境之间的凭据和/或私钥不同。] >
不过,对于Github和Google,错误看起来有所不同。第一个错误(GitHub)好像您正在发送一个空令牌。
第二个错误(Google)似乎您正在发送与证书不匹配的私钥。基于on similar Java errors:
Invalid ECDH ServerKeyExchange signature
可以指示一个键和相应的证书不匹配,并导致握手失败。验证每个文件的内容用于配置的证书颁发机构,证书和键。特别要检查密钥和证书是否属于相同的密钥对。