mirror of
https://github.com/Thream/socketio-jwt.git
synced 2024-07-21 09:38:31 +02:00
Merge pull request #118 from Root-Core/store-jwt
Added option to store encoded jwt
This commit is contained in:
commit
fbae634992
@ -63,6 +63,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] = data.token;
|
||||||
|
|
||||||
var onJwtVerificationReady = function(err, decoded) {
|
var onJwtVerificationReady = function(err, decoded) {
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
@ -107,7 +110,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);
|
||||||
@ -169,6 +172,9 @@ function authorize(options, onConnection) {
|
|||||||
return auth.fail(error, data, accept);
|
return auth.fail(error, data, accept);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Store encoded JWT
|
||||||
|
data[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