mirror of
https://github.com/Thream/socketio-jwt.git
synced 2024-07-21 09:38:31 +02:00
Merge branch 'kripod-patch-2'
This commit is contained in:
commit
93a4474686
@ -53,7 +53,7 @@ function noQsMethod(options) {
|
|||||||
|
|
||||||
// success handler
|
// success handler
|
||||||
var onSuccess = function() {
|
var onSuccess = function() {
|
||||||
socket.decoded_token = decoded;
|
socket[options.decodedPropertyName] = decoded;
|
||||||
socket.emit('authenticated');
|
socket.emit('authenticated');
|
||||||
if (server.$emit) {
|
if (server.$emit) {
|
||||||
server.$emit('authenticated', socket);
|
server.$emit('authenticated', socket);
|
||||||
@ -89,6 +89,8 @@ function noQsMethod(options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function authorize(options, onConnection) {
|
function authorize(options, onConnection) {
|
||||||
|
options = xtend({ decodedPropertyName: 'decoded_token' }, options);
|
||||||
|
|
||||||
if (!options.handshake) {
|
if (!options.handshake) {
|
||||||
return noQsMethod(options);
|
return noQsMethod(options);
|
||||||
}
|
}
|
||||||
@ -156,7 +158,7 @@ function authorize(options, onConnection) {
|
|||||||
return auth.fail(error, data, accept);
|
return auth.fail(error, data, accept);
|
||||||
}
|
}
|
||||||
|
|
||||||
data.decoded_token = decoded;
|
data[options.decodedPropertyName] = decoded;
|
||||||
|
|
||||||
return auth.success(data, accept);
|
return auth.success(data, accept);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user