mirror of
https://github.com/NarrativeScience-old/log.io.git
synced 2026-04-26 01:25:55 +03:00
[GH-ISSUE #60] basic auth not working #44
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/log.io-NarrativeScience-old#44
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jochenonline on GitHub (Mar 31, 2013).
Original GitHub issue: https://github.com/NarrativeScience-old/log.io/issues/60
Hi,
this is my web_server.conf:
But when I access the log.io webserver, no username or password is required. The server shows up like without
auth. Of course I have restarted the server after changing the conf file. What is wrong?@d4fseeker commented on GitHub (Apr 4, 2013):
Same problem here on fresh install.
Fixed it by editing the lib/servers.js (/usr/local/lib/node_modules/log.io/lib/servers.js) and adding the following line after line 360:
It now reads with the line before and after:
You probably want to add an if/else conditioning to whether the auth already exists.
@peterfroehlich commented on GitHub (Apr 5, 2013):
Same here.
@ecaron commented on GitHub (Apr 22, 2013):
@d4fseeker, should the change in /usr/local/lib/node_modules/log.io/lib/server.js be wrapped in a:
@d4fseeker commented on GitHub (Apr 22, 2013):
I cannot access a log.io install atm, so you'll have to check but if I remember correctly the wrapper class always exists and thus would return bool/true no matter what.
You'd have to check config.auth.user and config.auth.pass to bypass that, e.g:
if(config.auth.user != null && config.auth.pass != null)
app.use(express.basicAuth(config.auth.user,config.auth.pass));
I have to admit I'm not sure if comparing against null is sufficient since CoffeeScript has made me lazy with it's "?" operator.
@gu3st commented on GitHub (Apr 23, 2013):
To be perfectly equivalent with Coffeescript's "?" Operator, you'd need to check for both null and undefined.
@jochenonline commented on GitHub (Jun 5, 2013):
This is the correct syntax:
@blackrosezy commented on GitHub (Aug 26, 2013):
and here is the coffee script :
@Dual-Boot commented on GitHub (Nov 2, 2013):
HI,
For me I fixed it like this (near line 360) file /usr/local/lib/node_modules/log.io/lib/server.js :
staticPath = (_ref = config.staticPath) != null ? _ref : __dirname + '/../';
// add fix start
app.use(express.basicAuth(config.auth.user, config.auth.pass))
if (config.auth && config.auth.user && config.auth.pass)
// fix end
return app.use(express"static");
And It works.
Regards,
@albertojm commented on GitHub (Dec 10, 2013):
Hi, I've downloaded & installed log.io today and still have no auth, my config file looks like:
exports.config = {
host: '0.0.0.0',
port: 28778,
// Enable HTTP Basic Authentication
auth: {
user: "test",
pass: "test123"
},
/*
// Enable HTTPS/SSL
ssl: {
key: '/path/to/privatekey.pem',
cert: '/path/to/certificate.pem'
},
*/
/*
// Restrict access to websocket (socket.io)
// Uses socket.io 'origins' syntax
restrictSocket: ':',
*/
/*
// Restrict access to http server (express)
restrictHTTP: [
"192.168.29.39",
"10.0.*"
]
*/
}
Any hint on why this is happening?
Thanks for your help.
@vansteki commented on GitHub (Dec 18, 2013):
@albertojm, i install by npm today and i have same problom.
if you check
/usr/lib/node_modules/log.io/src/server.coffee, you'll find something missing around line 180 and 181:if @auth?app.use express.basicAuth @auth.user, @auth.passit looks like code in npm is not the same in current repo...?
try add these to
/usr/lib/node_modules/log.io/lib/server.jsthen edit config file and run
it works for me!
@crackfoo commented on GitHub (Jun 4, 2014):
Thanks @vansteki ! that worked for me too.