mirror of
https://github.com/Lissy93/dashy.git
synced 2024-11-23 04:34:44 +03:00
15 lines
517 B
JavaScript
15 lines
517 B
JavaScript
module.exports = (config, req) => {
|
|
try {
|
|
if ( config.appConfig.auth.enableHeaderAuth ) {
|
|
const userHeader = config.appConfig.auth.headerAuth.userHeader;
|
|
const proxyWhitelist = config.appConfig.auth.headerAuth.proxyWhitelist;
|
|
if ( proxyWhitelist.includes(req.socket.remoteAddress) ) {
|
|
return { "success": true, "user": req.headers[userHeader.toLowerCase()] };
|
|
}
|
|
}
|
|
return {};
|
|
} catch (e) {
|
|
console.warn("Error get-user: ", e);
|
|
return { 'success': false };
|
|
}
|
|
}; |