-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Closed
Description
I don't see any way to access req.connection
from inside socket.io's authorization
callback. Is there any? I need to access the peer certificate to get the identity of the connected user (over wss://)
Currently I must hot-swap Manager.handshakeData
for the method below, which adds the peer certificate to the data passed to the authorization
callback, but it would be nice to have a clearly defined way.
if (typeof io.Manager.prototype._handshakeDataPC !== "function") {
io.Manager.prototype._handshakeDataPC = io.Manager.prototype.handshakeData
io.Manager.prototype.handshakeData = function(data) {
var d = this._handshakeDataPC(data),
connection = data.request.connection
d['peer certificate'] = connection.authorized ? connection.getPeerCertificate() : null
return d
}
}
Metadata
Metadata
Assignees
Labels
No labels