kaazing / gateway

Kaazing Gateway
Apache License 2.0
141 stars 84 forks source link

HttpProxyAuthenticationIT uses wrong scripts #830

Closed jitsni closed 7 years ago

jitsni commented 7 years ago

For e.g. authenticationBasic() script uses

accept tcp://localhost:8080
accepted
connected
...
write status "200" "OK"
write close

This is mixing tcp and http syntax. There is k3po exception also (but the test passes due to some other reasons)

java.lang.ClassCastException: org.jboss.netty.channel.socket.nio.DefaultNioSocketChannelConfig cannot be cast to org.kaazing.k3po.driver.internal.netty.bootstrap.http.HttpChannelConfig
    at org.kaazing.k3po.driver.internal.behavior.handler.codec.http.HttpStatusEncoder.encode(HttpStatusEncoder.java:39)
    at org.kaazing.k3po.driver.internal.behavior.handler.command.WriteConfigHandler.invokeCommand(WriteConfigHandler.java:49)
    at org.kaazing.k3po.driver.internal.behavior.handler.command.AbstractCommandHandler$1.operationComplete(AbstractCommandHandler.java:47)
    at org.jboss.netty.channel.DefaultChannelFuture.notifyListener(DefaultChannelFuture.java:409)
apirvu commented 7 years ago

Hi @jitsni, there are 2 scripts with this issue: http.proxy.auth.authentication.basic.rpt and http.proxy.auth.authentication.digest.rpt. Replacing tcp with http generated an error related to missing path: org.jboss.netty.channel.ChannelException: http path missing.

After using http and path as in accept http://localhost:8080/resource, a org.junit.ComparisonFailure: Specified behavior did not match is issued. Scripts are on my fork.

auth_digest_k3po

It seems what comes after connect/accept is not read anymore. This would also explain why it worked with tcp. Will investigate more on this.

jitsni commented 7 years ago

Yes, I was telling the same to @dpwspoon. We need to fix all the scripts which has this problem.

apirvu commented 7 years ago

I've modified the scripts to only use TCP. With Http, it kept returning Exception errors.

But the basic Auth fails, as Gateway returns 504 instead of 200. Here's my version. The digestAuth also fails with java.lang.InterruptedException.

sbadugu commented 7 years ago

@apirvu Please create a PR and Jitu will review it.

apirvu commented 7 years ago

@jitsni : please review PR 849 - both scripts are using HTTP and they're passing.