CloudNetService / CloudNet

A modern application that can dynamically and easily deliver Minecraft oriented software
https://cloudnetservice.eu
Apache License 2.0
369 stars 115 forks source link

feat: extend websocket support #1353

Closed NitrinCloud closed 1 week ago

NitrinCloud commented 5 months ago

Motivation

JavaScript WebSocket API does not support adding authorization headers making the live console endpoint unusable. The only controllable header is Sec-WebSocket-Protocol, which is not convenient to use and support.

Modification/Result

Methods or parameter annotated with TokenAuth allows to either add the generated token as a bearer token or as a query parameter.

I made the decision to create a third annotation because this will still force a user to use the correct header if the endpoint won't upgrade to a websocket connection later on.

0utplay commented 1 week ago

Hi, sorry for the late reply on this. We are currently rewriting the rest module and have solved this issue there. Thanks for you effort.