-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
Hi!
It is possible use the default io.dropwizard.auth with dropwizard-websockets?
In our project we are using OAuth authenticantion in resources.
I'm testing this class
@Timed(name = "timed")
@Metered(name = "metered")
@ExceptionMetered(name = "exception")
@ServerEndpoint("/socket")
@PermitAll
public class NotificationSocket {
@OnOpen
public void myOnOpen(final Session session) throws IOException {
System.out.println("Principal: " + session.getUserPrincipal());
session.getAsyncRemote().sendText("welcome");
}
@OnMessage
public void myOnMsg(final Session session, String message) {
session.getAsyncRemote().sendText(message);
}
@OnClose
public void myOnClose(final Session session, CloseReason cr) {
}
}with this simple node script:
var WebSocket = require('ws')
const options = {
headers: {
'Authorization': 'Bearer token' // token is a system generated string
}
}
const ws = new WebSocket('ws://localhost:58040/socket', options)
ws.on('message', function incoming(data) {
console.log(data);
})and the Principal always is null.
I want to associate each session ith the logged user.
Thanks!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels