11

I'm using Cro HTTP Authentication/Authorization/Sessions very successfully with HTTP routes.

Then I added a route that creates a web-socket using Cro::HTTP::Router::WebSocket, and I can connect to it with Cro::WebSocket::Client and everything works fine.

Now I want to control access to the websocket, so I add a Cro::HTTP::Auth parameter. Works great. Now the the client gets a 401 Unauthorized as expected.

Next step, how do I open the door?

With Cro::HTTP::Client, I can pass in an Authorization header, or even pass in the auth option. How do I do that with Cro::WebSocket::Client?

I'm very new to WebSocket, so I don't even know if this is the right way to do things like this, but it seems like the Cro::WebSocket::Client connect method should take a headers named option that gets extra headers that get passed along.

Curt Tilmes
  • 3,035
  • 1
  • 12
  • 24
  • I'd advise opening an issue in https://github.com/croservices/cro-websocket about this. The Cro team are pretty quick to respond. A cursory glance over the code doesn't look like Authorization headers on the initial connection are currently possible. – Scimon Proctor Sep 20 '18 at 10:41
  • Raised an issue on GitHub: https://github.com/croservices/cro-websocket/issues/16 – Curt Tilmes Sep 20 '18 at 10:43
  • I didn't realize -- it looks like there is already a patch to do this: https://github.com/croservices/cro-websocket/pull/3 – Curt Tilmes Sep 20 '18 at 12:40

1 Answers1

2

The mentioned patch from titsuki was merged by Jonathan Worthington with commit 2593e21 on Oct 14, 2018

LuVa
  • 2,288
  • 2
  • 10
  • 20