com.nimbusds.jose.RemoteKeySourceException:无法检索远程JWK集:主机名验证失败

时间:2017-07-19 02:20:47

标签: java jwt nimbus jwk

我使用的是Nimbus-JOSE-JWT库(版本4.39)。使用这个库,我正在尝试进行本地JWT令牌验证,从而从OAuth授权服务器中下载JWK集。

当我在JSE应用程序中运行它时,我的代码运行得非常好,但是,当我在WebLogic 12.1.3中运行完全相同的代码(作为JEE应用程序的一部分)时,它无法运行,但出现以下异常: / p>

com.nimbusds.jose.RemoteKeySourceException: Couldn't retrieve remote JWK set: Hostname verification failed: HostnameVerifier=weblogic.security.utils.SSLWLSHostnameVerifier, hostname=corpZ.oktapreview.com.
    at com.nimbusds.jose.jwk.source.RemoteJWKSet.updateJWKSetFromURL(RemoteJWKSet.java:141)
    at com.nimbusds.jose.jwk.source.RemoteJWKSet.get(RemoteJWKSet.java:219)
    at com.nimbusds.jose.proc.JWSVerificationKeySelector.selectJWSKeys(JWSVerificationKeySelector.java:129)
    at com.nimbusds.jwt.proc.DefaultJWTProcessor.process(DefaultJWTProcessor.java:323)
    at com.nimbusds.jwt.proc.DefaultJWTProcessor.process(DefaultJWTProcessor.java:284)
    at com.nimbusds.jwt.proc.DefaultJWTProcessor.process(DefaultJWTProcessor.java:275)
    at org.corpZ.sec.okta.OktaClient.getAccessTokenInfoLocally(Unknown Source)
    at org.corpZ.sec.okta.OktaClient.validateAccessTokenLocally(Unknown Source)
    at org.corpZ.sec.okta.TokenValidator.isTokenValid(Unknown Source)
    at org.corpZ.eis.ws.interceptor.WSInterceptor.handleRequest(WSInterceptor.java:126)
    at org.springframework.ws.server.endpoint.interceptor.DelegatingSmartEndpointInterceptor.handleRequest(DelegatingSmartEndpointInterceptor.java:78)
    at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:224)
    at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:173)
    at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:88)
    at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:59)
    at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:292)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
    at javax.servlet.http.HttpServlet.service(HttpServ

以下是我在代码中的Maven依赖项:

<dependency>
  <groupId>com.nimbusds</groupId>
  <artifactId>nimbus-jose-jwt</artifactId>
  <version>4.39</version>
</dependency>

非常感谢任何帮助。

感谢。

1 个答案:

答案 0 :(得分:0)

迟到总比没有好,这是由于WebLogic服务器配置所致。您必须进入SSL属性选项卡,并将“主机名验证”更改为“无”。