Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
passport-tequila
Advanced tools
[Passport](https://github.com/jaredhanson/passport) strategy for authenticating with [Tequila](http://tequila.epfl.ch/).
Passport strategy for authenticating with Tequila.
This module lets you authenticate and controll access using Tequila in your Node.js applications that use a Connect-style middleware, including Express. Plain old Node.js servers will also be supported at some point in the future (but don't work right now).
$ npm install passport-tequila
See the express and passport demo app for a working example (requires a Tequila server in your domain, which means it is most likely to work from inside EPFL).
var tequila = require('passport-tequila');
var myStrategy = new tequila.Strategy({
service: "The name of my app", // Appears on Tequila login screen
request: ["displayname", "firstname"], // Personal info to fetch
},
function(userKey, profile, done) {
User.findOrCreate(profile, function (err, user) {
done(err, user);
});
}
);
passport.use(myStrategy);
Tequila is designed so that Web apps redirect unauthenticated users to the Tequila server, which redirects back to the protected page or resource the user started from.
In a Node.js app, this is achieved by using the
'myStrategy.ensureAuthenticated'
function as middleware:
app.get('/private', tequila.ensureAuthenticated, function(req, res){ // .. business as usual });
When the user is authenticated (regardless of whether the page they
are on uses the tequila.ensureAuthenticated middleware mentioned
above), 'req.user'
holds the user's identity as fetched from the
Tequila server:
req.user.displayName // Conforms to http://passportjs.org/guide/profile/
req.user.tequila.key // Tequila-specific additions
Note that e.g. 'req.user.displayName'
only appears if it was explicitly
requested from Tequila (see above, Configuring the Strategy).
To log out the user from this app only:
app.get('/logout', function(req, res){ req.logout(); res.redirect('/'); });
Alternatively, one can also log out from Tequila altogether like this.
app.get('/globallogout', myStrategy.globalLogout("/"));
(The MIT License)
Copyright (c) 2015 Ecole Polytechnique Federale de Lausanne, Switzerland
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.
FAQs
[Passport](https://github.com/jaredhanson/passport) strategy for authenticating with [Tequila](http://tequila.epfl.ch/).
We found that passport-tequila demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.