mirror of
https://github.com/Thream/socketio-jwt.git
synced 2024-07-21 09:38:31 +02:00
set required defaults to true
This commit is contained in:
parent
9325691f29
commit
9b234c44a8
11
lib/index.js
11
lib/index.js
@ -3,6 +3,9 @@ var jwt = require('jsonwebtoken');
|
|||||||
var UnauthorizedError = require('./UnauthorizedError');
|
var UnauthorizedError = require('./UnauthorizedError');
|
||||||
|
|
||||||
function noQsMethod(options) {
|
function noQsMethod(options) {
|
||||||
|
var defaults = { required: true };
|
||||||
|
options = xtend(defaults, options);
|
||||||
|
|
||||||
return function (socket) {
|
return function (socket) {
|
||||||
var server = this;
|
var server = this;
|
||||||
|
|
||||||
@ -56,6 +59,10 @@ function noQsMethod(options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function authorize(options, onConnection) {
|
function authorize(options, onConnection) {
|
||||||
|
if (!options.handshake) {
|
||||||
|
return noQsMethod(options);
|
||||||
|
}
|
||||||
|
|
||||||
var defaults = {
|
var defaults = {
|
||||||
success: function(data, accept){
|
success: function(data, accept){
|
||||||
if (data.request) {
|
if (data.request) {
|
||||||
@ -75,10 +82,6 @@ function authorize(options, onConnection) {
|
|||||||
|
|
||||||
var auth = xtend(defaults, options);
|
var auth = xtend(defaults, options);
|
||||||
|
|
||||||
if (!options.handshake) {
|
|
||||||
return noQsMethod(options);
|
|
||||||
}
|
|
||||||
|
|
||||||
return function(data, accept){
|
return function(data, accept){
|
||||||
var token, error;
|
var token, error;
|
||||||
var req = data.request || data;
|
var req = data.request || data;
|
||||||
|
Loading…
Reference in New Issue
Block a user