-
Notifications
You must be signed in to change notification settings - Fork 62
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
59 changed files
with
7,462 additions
and
167 deletions.
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
node_modules | ||
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,39 @@ | ||
{ | ||
"camelcase": false, | ||
"curly": false, | ||
|
||
"node": true, | ||
"esnext": true, | ||
"bitwise": true, | ||
"eqeqeq": true, | ||
"immed": true, | ||
"indent": 2, | ||
"latedef": false, | ||
"newcap": true, | ||
"noarg": true, | ||
"regexp": true, | ||
"undef": true, | ||
"strict": false, | ||
"smarttabs": true, | ||
"expr": true, | ||
|
||
"evil": true, | ||
"browser": true, | ||
"regexdash": true, | ||
"wsh": true, | ||
"trailing": true, | ||
"sub": true, | ||
"unused": true, | ||
"laxcomma": true, | ||
"nonbsp": true, | ||
|
||
"globals": { | ||
"after": false, | ||
"before": false, | ||
"afterEach": false, | ||
"beforeEach": false, | ||
"describe": false, | ||
"it": false, | ||
"escape": false | ||
} | ||
} |
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,5 @@ | ||
language: node_js | ||
before_install: npm i -g [email protected] | ||
node_js: | ||
- 4 | ||
- 6 |
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 |
---|---|---|
@@ -1,20 +1,21 @@ | ||
(The MIT License) | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2011 Matias Woloski (Auth10) | ||
Copyright (c) 2015 Auth0, Inc. <[email protected]> (http://auth0.com) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,23 @@ | ||
Security vulnerability details for passport-wsfed-saml2 < 3.0.5 | ||
=============================================================== | ||
|
||
A vulnerability has been discovered in the passport-wsfed-saml2 library affecting versions < 3.0.5. This vulnerability allows an attacker to impersonate another user and potentially elevate their privileges if the SAML identity provider: | ||
|
||
* signs SAML response and signs assertion | ||
* does not sign SAML response and signs assertion | ||
|
||
Developers using the passport-wsfed-saml2 Passport Strategy need to upgrade to the latest version: 3.0.5. | ||
|
||
Updated packages are available on npm. To ensure delivery of additional bug fixes moving forward, please make sure your `package.json` file is updated to take patch and minor level updates of our libraries. See below: | ||
|
||
``` | ||
{ | ||
"dependencies": { | ||
"passport-wsfed-saml2": "^3.0.5" | ||
} | ||
} | ||
``` | ||
|
||
## Upgrade Notes | ||
|
||
This fix patches the library that your application runs, but will not impact your users, their current state, or any existing sessions. |
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,90 @@ | ||
var express = require('express'); | ||
var passport = require('passport'); | ||
var Strategy = require('../../lib/passport-wsfed-saml2/index').Strategy; | ||
var http = require('http'); | ||
|
||
passport.serializeUser(function(user, done) { | ||
done(null, user); | ||
}); | ||
|
||
passport.deserializeUser(function(id, done) { | ||
done(null, id); | ||
}); | ||
|
||
passport.use(new Strategy( | ||
{ | ||
protocol: 'samlp', | ||
path: '/login/callback', | ||
realm: 'urn:saml-example', | ||
homeRealm: '', | ||
// identityProviderUrl: 'https://mdocs.auth0.com/samlp/dVrQZOG4gkBhzcLartSgW2v7kSnvW5XR?connection=github', | ||
// thumbprint: 'c5b930896e3f4e2cc1d6d1ceb68f4d3de90deee6' | ||
identityProviderUrl: 'https://login0.myauth0.com/samlp/wklezTET2P3iYA54Sraju8qFN0ohdI0G', | ||
thumbprints: ['dba77ba142ff38d5076b4310700709c470d53790'] | ||
}, function(profile, done) { | ||
console.log("Auth with", profile); | ||
if (!profile.email) { | ||
return done(new Error("No email found"), null); | ||
} | ||
done(null, profile); | ||
} | ||
)); | ||
|
||
var app = express(); | ||
|
||
// configure Express | ||
app.configure(function() { | ||
app.set('views', __dirname + '/views'); | ||
app.set('view engine', 'ejs'); | ||
app.use(express.logger()); | ||
app.use(express.cookieParser()); | ||
app.use(express.bodyParser()); | ||
app.use(express.methodOverride()); | ||
app.use(express.session({ secret: 'keyboard cat' })); | ||
app.use(passport.initialize()); | ||
app.use(passport.session()); | ||
app.use(app.router); | ||
app.use(express.static(__dirname + '/../../public')); | ||
}); | ||
|
||
|
||
app.get('/', function(req, res){ | ||
res.render('index', { user: req.user }); | ||
}); | ||
|
||
app.get('/account', ensureAuthenticated, function(req, res){ | ||
res.render('account', { user: req.user }); | ||
}); | ||
|
||
app.get('/login', | ||
passport.authenticate('wsfed-saml2', { failureRedirect: '/', forceAuthn: true }), | ||
function(req, res) { | ||
res.redirect('/'); | ||
} | ||
); | ||
|
||
app.post('/login/callback', | ||
passport.authenticate('wsfed-saml2', { failureRedirect: '/' }), | ||
function(req, res) { | ||
res.redirect('/'); | ||
} | ||
); | ||
|
||
app.get('/logout', function(req, res){ | ||
req.logout(); | ||
res.redirect('/'); | ||
}); | ||
|
||
http.createServer(app).listen(3000, function () { | ||
console.log("Server listening in http://localhost:3000"); | ||
}); | ||
|
||
// Simple route middleware to ensure user is authenticated. | ||
// Use this route middleware on any resource that needs to be protected. If | ||
// the request is authenticated (typically via a persistent login session), | ||
// the request will proceed. Otherwise, the user will be redirected to the | ||
// login page. | ||
function ensureAuthenticated(req, res, next) { | ||
if (req.isAuthenticated()) { return next(); } | ||
res.redirect('/login'); | ||
} |
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,10 @@ | ||
{ | ||
"name": "passport-azure-acs-sample", | ||
"version": "0.0.0", | ||
"dependencies": { | ||
"express": ">= 0.0.0", | ||
"ejs": ">= 0.0.0", | ||
"passport": ">= 0.0.0", | ||
"passport-azure-acs": ">= 0.0.0" | ||
} | ||
} |
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 @@ | ||
<p>ID: <%= user.id %></p> | ||
<p>Name: <%= user.displayName %></p> |
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,5 @@ | ||
<% if (!user) { %> | ||
<h2>Welcome! Please log in.</h2> | ||
<% } else { %> | ||
<h2>Hello, <%= user.email %>.</h2> | ||
<% } %> |
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,21 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Passport-Windows Azure Access Control Service Example</title> | ||
</head> | ||
<body> | ||
<% if (!user) { %> | ||
<p> | ||
<a href="/">Home</a> | | ||
<a href="/login">Log In</a> | ||
</p> | ||
<% } else { %> | ||
<p> | ||
<a href="/">Home</a> | | ||
<a href="/account">Account</a> | | ||
<a href="/logout">Log Out</a> | ||
</p> | ||
<% } %> | ||
<%- body %> | ||
</body> | ||
</html> |
Oops, something went wrong.