2011-09-16 7 views
2

(node.jsで)単純なサイト(例:http://www.mydomain.com)を開発し、クライアントがhttps(例:https://www.mydomain.com/login)で認証できるようにします。正常に認証されると、http://www.google.com/support/licensing/にある自分のサイトにリダイレクトされます。(安全でない)Nodejs、httpsによる認証とhttpへのリダイレクト

どうすればいいですか?私は、2つの異なるポート(httpで80、httpsで443)の2つのノードインスタンスを実行する2つの単純なファイル(mydomain.jsとmydomainsecure.js)を作成しましたが、https(およびHTTPにリダイレクト)ログインしてください(明らかに????)

これを実装する正しい方法は何ですか?

答えて

0

similar questionクライアント側のリダイレクトがソリューションの一部です。 Yahoo authenticationの詳細については、こちらをご覧ください。

0

あなたはそのためhttp-authモジュールを使用することができます。

// Authentication module. 
var auth = require('http-auth'); 
var basic = auth.basic({ 
    realm: "Simon Area.", 
    file: __dirname + "/../data/users.htpasswd" // gevorg:gpass, Sarah:testpass ... 
}); 

// Creating new HTTP server. 
http.createServer(basic, function(req, res) { 
    res.end("Welcome to private area - " + req.user + "!"); 
}).listen(1337); 
関連する問題