0
votes

I'm using Play Framework with Scala to build a RESTful API. To implement authentication I'm using the play-silhouette plugin, with the use of a BearerTokenAuthenticator. It works perfectly.

The problem is that I must implement a service that use a WebSocket to push real-time updates, but I can't manage to setup user authentication for this method.

Silhouette provides support to do that (doc), the problem is that I can't find a way to put the token in the header of the websocket handshake requests. I did a lot of research, but without any result.

I thought that I could pass the token in the query string, instead of passing it in the request header.

My question is, how can I validate a token manually with silhouette?

1

1 Answers

1
votes

This is currently not possible. I've created an issue to fix this with the help of a request extractor.

In the meantime you could override the retrieve method of the BearerTokenAuthenticatorService and use the value from query string instead of the header.