Socket
Book a DemoInstallSign in
Socket

passport-ubuntu

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

passport-ubuntu

Ubuntu OpenID authentication strategy for Passport

0.2.0
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

Passport-Ubuntu

Passport strategy for authenticating with Ubuntu using OpenID.

Install

$ npm install --save passport-ubuntu

Example

passport.use(new UbuntuStrategy({
  returnURL: 'https://example.com/auth/ubuntu/return',
  realm: 'https://example.com',
  stateless: true,
},
function(identifier, profile, done) {
  User.findOne({identifier: identifier}, function(err, user) {
    if (err) {
      done(err);
    }
    else {
      done(null, user);
    }
  });
}));

app.post('/auth/ubuntu', passport.authenticate('ubuntu'));
app.get('/auth/ubuntu/return', passport.authenticate('ubuntu', {
  successRedirect: '/auth/me',
  failureRedirect: '/auth/login'
}));
app.post('/auth/ubuntu/return', passport.authenticate('ubuntu', {
  successRedirect: '/auth/me',
  failureRedirect: '/auth/login'
}));

app.get('/auth/login', function(req, res) {
  res.send('<form action="/auth/ubuntu" method="post"><div><input type="submit" value="Sign In"/></div></form>');
});

app.get('/auth/me', function(req, res) {
  res.send(req.user);
});

app.get('/auth/logout', function(req, res){
  req.logout();
  res.redirect('/');
});

License

Copyright (C) 2017 Brian Douglass

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3, as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Keywords

passport

FAQs

Package last updated on 11 May 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.