is it possible to drop a websocket Connection from within an Inbound policy ?
Scenario is the following:
How to achieve this scenario,
If we are not able to drop the connection, than we would need to remember that this connection is authenticated, because the tolken is not part of any further Messages sent through this WS channel.
Thanks for thoughts and help.
Customize Error Response assertion can be configured to drop the connection :
Select the response to use for an error:
Customize Error Response Assertion - CA API Gateway - 9.2 - CA Technologies Documentation
Another option is to use Return Template Response to Request. It also has the option to drop the connection:
Select this check box to send the template response message immediately, with or without a payload. The transmission of a payload depends on the status code (for example, a '204 (No Content) response status indicates to skip payload transmission).
Clear this check box to send the template response at the completion of the policy.
WARNING: Do not enable this option for most common use cases. Doing so closes the connection immediately and disables keep-alive, causing significant performance degradation. Additionally, the Gateway will apply no WS-Security decoration to the response message.
Return Template Response to Requestor Assertion - CA API Gateway - 9.2 - CA Technologies Documentation
This seems to be exactly, what I was looking for.
Too bad I didn't recognize this assertion by my own.
Thanks a ton for this hint. I will give it a try and let you know.
I did a short test and it seems that this assertion does not drop the websocket connection from within an inbound policy as exepcted. It seems not to be feasible for this approach.
I'm not expert on websockets but doing some research, the protocol demands an exchange to interpret the close connection command.
RFC 6455 - The WebSocket Protocol
Probably, when we use the assertions to drop the connection, it drops the TCP connection but the client doesn't recognize it.
Thanks a lot and best regards