I'm trying to use a module like http-auth<https://github.com/gevorg/http-auth/> 
to 
centrally auth HTTP traffic before piping it along to "actual" HTTP servers 
via TCP stream.

Ideally, I could do something like:

net.createServer(function(sock) {
   sock.pipe(httpAuth).pipe(remoteHTTP) *// thus remoteHTTP's traffic is always 
authenticated*
}).listen(9798)
 
var remoteHTTP = net.connect(6788)* // some HTTP service*

But the problem is http-auth expects to be passed a req, res:

var auth = require('http-auth')var basic = auth({
    authRealm : "Private area.",
    authList : ['mia:{SHA}x511ncXd+4fOnYAotcGPFD0peYo=']});
http.createServer(function(req, res) {
    // Apply authentication to server.
    basic.apply(req, res, function(username) {
        // Your request handling logic goes there
        res.end("Welcome to private area - " + username + "!");
    });}).listen(1337);

Is there any way to convert a net stream into a format that could be 
handled by something like http-auth? Or another way to do http digest auth 
without interrupting the streams?

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to