webhub.js
function authorised(request) {
	// JWT is usually passed via an HTTP header
    let token = request.headers.authorization;
    
    // For EventSource and WebSocket, JWT is passed as a URL parameter
    if (token === undefined) {
    	let url = URL.parse(request.url, true);
    	
    	if (url.query)
    		token = url.query.jwt;
    }
    
    // ask app to validate JWT authorisation token
    return (!token || config.validateJWT(token, request.url));
}
function authorised(request) {
	// JWT is usually passed via an HTTP header
    let token = request.headers.authorization;
    
    // For EventSource and WebSocket, JWT is passed as a URL parameter
    if (token === undefined) {
    	let url = URL.parse(request.url, true);
    	
    	if (url.query)
    		token = url.query.jwt;
    }
    
    // ask app to validate JWT authorisation token
    return (!token || config.validateJWT(token, request.url));
}
function authorised ( request ) { // JWT is usually passed via an HTTP header let token = request . headers . authorization ; // For EventSource and WebSocket, JWT is passed as a URL parameter if ( token === undefined ) { let url = URL . parse ( request . url , true ) ; if ( url . query ) token = url . query . jwt ; } // ask app to validate JWT authorisation token return ( ! token || config . validateJWT ( token , request . url ) ) ; }
helper for HTTP request authorisation
helper for HTTP request authorisation