added ability to enforce only header authorization versus query string authorization - DK/MW

This commit is contained in:
Mathew Woods
2016-10-20 11:13:23 -05:00
committed by Fabian Arndt
parent 2d390e66e6
commit ef0983a702
3 changed files with 90 additions and 45 deletions

View File

@ -158,7 +158,14 @@ function authorize(options, onConnection) {
}
}
//get the token from handshake or query string
// Check if the header has to include authentication
if (options.auth_header_required && !token) {
return auth.fail(new UnauthorizedError('missing_authorization_header', {
message: 'Server requires Authorization Header'
}), data, accept);
}
// Get the token from handshake or query string
if (handshake && handshake.query.token){
token = handshake.query.token;
}