为了账号安全,请及时绑定邮箱和手机立即绑定

如何在gocloak中跳过(X509)证书验证?

如何在gocloak中跳过(X509)证书验证?

Go
波斯汪 2023-08-21 14:43:37
我正在尝试使用gocloak从 keycloak 验证我的令牌,并为此使用以下代码。token:=""client:= gocloak.NewClient("https://example.com")_, err := client.RetrospectToken(token,"client-id" ,"client-secret", "realm")log.Print(err.Error())我遇到以下错误,Post https://example.com/auth/realms/realm/protocol/openid-connect/token/introspect: x509: certificate signed by unknown authority有什么办法可以跳过 gocloak 中的证书验证吗?
查看完整描述

1 回答

?
米琪卡哇伊

TA贡献1998条经验 获得超6个赞

因此,您正在寻找跳过 TLS 中的证书验证的方法,请尝试使用RestyClient


token:=""

client := gocloak.NewClient(serverURL)

restyClient := client.RestyClient()

restyClient.SetDebug(true)

restyClient.SetTLSClientConfig(&tls.Config{ InsecureSkipVerify: true })

_, err := client.RetrospectToken(token,"client-id" ,"client-secret", "realm")

log.Print(err.Error())


查看完整回答
反对 回复 2023-08-21
  • 1 回答
  • 0 关注
  • 43 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信