pp
passport-ping
npm i passport-ping
pp

passport-ping

Passport strategy for authenticating with PingFederate using the OAuth 2.0 API

by Alex Thieme

0.1.1 (see all)License:MITTypeScript:Not Found
npm i passport-ping
Readme

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

License

The MIT License

Downloads/wk

1.5K

GitHub Stars

14

LAST COMMIT

9yrs ago

MAINTAINERS

1

CONTRIBUTORS

1

OPEN ISSUES

1

OPEN PRs

0
VersionTagPublished
0.1.1
latest
9yrs ago
No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

100
No reviews found
Be the first to rate