Authentication 如何配置Knox使其将授权头传递给后端服务?

Authentication 如何配置Knox使其将授权头传递给后端服务?,authentication,websocket,knox-gateway,Authentication,Websocket,Knox Gateway,正如我在问题中所讨论的,Knox中不支持websockets身份验证,但作为一种临时解决方案,我们可以在后端服务中处理身份验证。但是,我们的测试表明,Knox不会将授权头传递给后端 [client]$ curl -i -u '<user>:<password>' https://knox-server/gateway/default/myservice/ping # 8090 is our backend port [knox-server]$ ngrep -W byl

正如我在问题中所讨论的,Knox中不支持websockets身份验证,但作为一种临时解决方案,我们可以在后端服务中处理身份验证。但是,我们的测试表明,Knox不会将授权头传递给后端

[client]$ curl -i -u '<user>:<password>' https://knox-server/gateway/default/myservice/ping

# 8090 is our backend port
[knox-server]$ ngrep -W byline port 8090
interface: eth0
filter: ( port 8090 ) and ((ip || ip6) || (vlan && (ip || ip6)))

#
T <knox-server>:59118 -> <myservice>:8090 [AP]
GET /ping?doAs=<user> HTTP/1.1.
X-Forwarded-For: <client>.
X-Forwarded-Proto: https.
X-Forwarded-Port: 443.
X-Forwarded-Host: <knox-server>.
X-Forwarded-Server: <knox-server>.
X-Forwarded-Context: /gateway/default.
User-Agent: curl/7.54.0.
Accept: */*.
Host: <myservice>:8090.
Connection: Keep-Alive.
Accept-Encoding: gzip,deflate.
.

#
T <myservice>:8090 -> <knox-server>:59118 [AP]
HTTP/1.1 200 OK.
Date: Sat, 14 Oct 2017 14:27:58 GMT.
X-Application-Context: myservice:prod:8090.
Content-Type: text/plain;charset=utf-8.
Content-Length: 4.
.
PONG
[client]$curl-i-u':'https://knox-server/gateway/default/myservice/ping
#8090是我们的后端端口
[knox服务器]$ngrep-W署名端口8090
接口:eth0
筛选器:(端口8090)和((ip | | ip6)| |(vlan和(ip | | ip6)))
#
T:59118->:8090[AP]
GET/ping?doAs=HTTP/1.1。
X-Forwarded-For:。
X-Forwarded-Proto:https。
X端口:443。
X主机:。
X-Forwarded-Server:。
X-Forwarded-Context:/gateway/默认值。
用户代理:curl/7.54.0。
接受:*/*。
主机:8090。
连接:保持活力。
接受编码:gzip,deflate。
.
#
T:8090->:59118[AP]
HTTP/1.1200ok。
日期:2017年10月14日星期六14:27:58 GMT。
X-Application-Context:myservice:prod:8090。
内容类型:文本/纯文本;字符集=utf-8。
内容长度:4。
.
庞

我应该如何配置Knox(HDP 2.6.2中的0.12.0)以使其将授权标头传递到后端进行websocket连接?

在编写此问题时,我意识到在Knox 0.14.0中有一个解决将Cookie和标头传递到后端服务的问题的票证

[编辑]

我克隆了knox git repo(commit 92b1505a),其中包括knox-895(2d236e78),在本地运行它,并将websocket服务添加到沙盒拓扑中

[tulinski]$ wscat -n --auth 'user:password' -c wss://localhost:8443/gateway/sandbox/echows
[tulinski]$ sudo ngrep -W byline host echo.websocket.org
#
T 192.168.0.16:59952 -> 174.129.224.73:80 [AP]
GET / HTTP/1.1.
Host: echo.websocket.org.
Upgrade: websocket.
Connection: Upgrade.
Sec-WebSocket-Key: Z4Qa9Dxwr6Qvq2QAicsT5Q==.
Sec-WebSocket-Version: 13.
Pragma: no-cache.
Cache-Control: no-cache.
Authorization: Basic dXNlcjpwYXNzd29yZA==.
.

##
T 174.129.224.73:80 -> 192.168.0.16:59952 [AP]
HTTP/1.1 101 Web Socket Protocol Handshake.
Connection: Upgrade.
Date: Mon, 16 Oct 2017 14:23:49 GMT.
Sec-WebSocket-Accept: meply+6cIyjbH+Vk2OsAqKJDWic=.
Server: Kaazing Gateway.
Upgrade: websocket.
.
授权标头被传递到后端服务