mirror of
https://github.com/Thream/socketio-jwt.git
synced 2024-07-21 09:38:31 +02:00
Added option to store encoded jwt, default "encoded_token"
This commit is contained in:
parent
90f431741b
commit
d340c81fd5
@ -61,6 +61,9 @@ function noQsMethod(options) {
|
|||||||
return onError({message: 'invalid token datatype'}, 'invalid_token');
|
return onError({message: 'invalid token datatype'}, 'invalid_token');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Store encoded JWT
|
||||||
|
socket[options.encodedPropertyName] = token;
|
||||||
|
|
||||||
var onJwtVerificationReady = function(err, decoded) {
|
var onJwtVerificationReady = function(err, decoded) {
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -105,7 +108,7 @@ function noQsMethod(options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function authorize(options, onConnection) {
|
function authorize(options, onConnection) {
|
||||||
options = xtend({ decodedPropertyName: 'decoded_token' }, options);
|
options = xtend({ decodedPropertyName: 'decoded_token', encodedPropertyName: 'encoded_token' }, options);
|
||||||
|
|
||||||
if (!options.handshake) {
|
if (!options.handshake) {
|
||||||
return noQsMethod(options);
|
return noQsMethod(options);
|
||||||
@ -167,6 +170,9 @@ function authorize(options, onConnection) {
|
|||||||
return auth.fail(error, data, accept);
|
return auth.fail(error, data, accept);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Store encoded JWT
|
||||||
|
socket[options.encodedPropertyName] = token;
|
||||||
|
|
||||||
var onJwtVerificationReady = function(err, decoded) {
|
var onJwtVerificationReady = function(err, decoded) {
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
|
Loading…
Reference in New Issue
Block a user