Spring Boot-Keycloak:“无法将代码转换为令牌” SSL

时间:2019-08-13 14:21:32

标签: spring spring-boot kubernetes keycloak kubernetes-ingress

我在kuberntes集群上具有与keycloak集成的spring boot。在生产中,我为受“ example.com”之类的域信任的SSL证书。我将Spring Boot Web应用程序和keycloak配置为与入口处于同一域路由下,并提供SSL以将我的证书重新用于两个服务器。

https://example.com->春季靴 https://example.com/auth->钥匙斗篷

这正常工作,但是当我尝试通过keycloak spring适配器从Web应用程序获取令牌时,我在日志中收到以下错误:

other_df['_0'] = other_df['Datetime']
bdf = sc.broadcast(other_df)

#merge asof udf
@F.pandas_udf('long')
def join_asof(v, other=bdf.value):
    f = pd.DataFrame(v)
    j = pd.merge_asof(f, other, on='_0', direction = 'forward')
    return j['Key']

joined = df.withColumn('Key', join_asof(F.col('Datetime')))
message:  "failed to turn code into token"   

Requests

1 个答案:

答案 0 :(得分:0)

此错误是因为用于验证jvm中的TLS连接的trustore不信任您用于keycloak服务器的证书。因此,将代码转换为令牌的请求从未完成。

您需要add the CA certificate in your jvm trustore

当您处于kubernetes环境中时,一种更简单的方法可能是使用keycloak适配器(https://www.keycloak.org/docs/latest/securing_apps/index.html#_java_adapter_config)所提供的功能:

  • trustore:使用特定的Trustore连接到密钥斗篷
  • disable-trust-manager:禁用证书验证(仅用于测试)