0

我在 apache knox 中设置了基于令牌的身份验证。我可以使用以下命令生成令牌:

curl -ivku guest:guest-password https://localhost:8443/gateway/sandbox/knoxtoken/api/v1/token

使用令牌,我在 curl 命令中进行身份验证,如下所示:

curl -ivk -H "Authorization: Bearer eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJndWVzdCIsImF1ZCI6InRva2VuYmFzZWQiLCJpc3MiOiJLTk9YU1NPIiwiZXhwIjoxNDg5OTQyMTg4fQ.bcqSK7zMnABEM_HVsm3oWNDrQ_ei7PcMI4AtZEERY9LaPo9dzugOg3PA5JH2BRF-lXM3tuEYuZPaZVf8PenzjtBbuQsCg9VVImuu2r1YNVJlcTQ7OV-eW50L6OTI0uZfyrFwX6C7jVhf7d7YR1NNxs4eVbXpS1TZ5fDIRSfU3MU" https://localhost:8443/gateway/tokenbased/webhdfs/v1/tmp?op=LISTSTATUS

但我想验证一个 hive jdbc 连接。如何在 hive jdbc url 中添加此令牌。我的 jdbc 网址是:

jdbc:hive2://localhost:8443/;ssl=true;sslTrustStore={path to gateway.jks};trustStorePassword={master-secret key};transportMode=http;httpPath=gateway/{cluster-name}/hive
4

1 回答 1

0

您应该能够通过 JDBC 传递带有 JWT 令牌的 http cookie,例如 jdbc:hive2://knox_host:knox_port;transportMode=http;httpPath=<http_endpoint>;http.cookie.<cookie_name>=<cookie_value>

默认 cookie 名称是“http.cookie.hadoop-jwt”

于 2018-08-17T22:09:21.440 回答