Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
80 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,6 @@ logs | |
results | ||
|
||
npm-debug.log | ||
node_modules | ||
|
||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
test | ||
Makefile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
language: node_js | ||
node_js: | ||
- 0.8 | ||
- 0.10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
var passport = require('passport'); | ||
|
||
|
||
exports.initialize = function() { | ||
var fn = passport.initialize(); | ||
|
||
return function initialize(socket, next) { | ||
var req = socket.request | ||
, res = req.res; | ||
|
||
fn(req, res, next); | ||
}; | ||
}; | ||
|
||
exports.session = function() { | ||
var fn = passport.session(); | ||
|
||
return function session(socket, next) { | ||
var req = socket.request | ||
, res = req.res; | ||
|
||
fn(req, res, next); | ||
}; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "socket.io-passport", | ||
"version": "0.0.0", | ||
"description": "Passport middleware for upcoming Socket.IO 1.0", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "node_modules/.bin/mocha --reporter dot" | ||
}, | ||
"keywords": [ | ||
"auth", | ||
"authentication", | ||
"connect", | ||
"socket.io", | ||
"passport", | ||
"middleware" | ||
], | ||
"author": "Naoyuki Kanezawa <naoyuki.kanezawa@gmail.com>", | ||
"license": "MIT", | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"passport": "*", | ||
"socket.io": "nkzawa/socket.io", | ||
"socket.io-client": "nkzawa/socket.io-client", | ||
"socket.io-bundle": "*", | ||
"mocha": "*", | ||
"chai": "*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
var passport = require('../') | ||
, expect = require('chai').expect; | ||
|
||
|
||
describe('socket.io-passport', function() { | ||
it('should create initialization middleware', function() { | ||
var initialize = passport.initialize(); | ||
expect(initialize).to.be.a('function'); | ||
expect(initialize.length).to.equal(2); | ||
}); | ||
|
||
it('should create session restoration middleware', function() { | ||
var session = passport.session(); | ||
expect(session).to.be.a('function'); | ||
expect(session.length).to.equal(2); | ||
}) | ||
}); |