Socket
Book a DemoInstallSign in
Socket

passport-pingfederate

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

passport-pingfederate

PingFederate authentication strategy for Passport

latest
Source
npmnpm
Version
0.1.1
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

Passport-Ping

Passport strategy for authenticating with PingFederate using the OAuth 2.0 API. This assumes you have a properly configured and running PingFederate server.

This module lets you authenticate using PingFederate in your Node.js applications. By plugging into Passport, PingFederate authentication can be easily and unobtrusively integrated into any application or framework that supports Connect-style middleware, including Express.

Install

$ npm install passport-ping

Usage

Configure Strategy

The PingFederate authentication strategy authenticates users using PingFederate and OAuth 2.0 tokens. The strategy requires a verify callback, which accepts these credentials and calls done providing a user, as well as options specifying a host, port, client ID, client secret, and callback URL.

passport.use(new PingStrategy({
    clientID: '123-456-789' ,
    clientSecret: 'shhh-its-a-secret' ,
    callbackURL: 'https://www.example.net/auth/ping/callback'
  },
  function(accessToken, refreshToken, profile, done) {
    User.findOrCreate(..., function (err, user) {
      return done(err, user);
    });
  }
));

passport.use(new PingStrategy({
    host: 'localhost' ,
    clientID: '123-456-789' ,
    clientSecret: 'shhh-its-a-secret' ,
    callbackURL: 'https://www.example.net/auth/ping/callback'
  },
  function(accessToken, refreshToken, profile, done) {
    User.findOrCreate(..., function (err, user) {
      return done(err, user);
    });
  }
));

passport.use(new PingStrategy({
    host: 'localhost' ,
    port: 9031 ,
    clientID: '123-456-789' ,
    clientSecret: 'shhh-its-a-secret' ,
    callbackURL: 'https://www.example.net/auth/ping/callback'
  },
  function(accessToken, refreshToken, profile, done) {
    User.findOrCreate(..., function (err, user) {
      return done(err, user);
    });
  }
));

Authenticate Requests

Use passport.authenticate(), specifying the 'ping' strategy, to authenticate requests.

For example, as route middleware in an Express application:

app.get('/auth/ping',
  passport.authenticate('ping'));

app.get('/auth/ping/callback',
  passport.authenticate('ping', { failureRedirect: '/login' }),
  function(req, res) {
    // Successful authentication, redirect home.
    res.redirect('/');
  });

Credits

  • Jared Hanson

License

The MIT License

Keywords

passport

FAQs

Package last updated on 13 Jan 2019

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