Giter Club home page Giter Club logo

passport-ibm's Introduction

Passport-IBM

Passport strategy for authenticating with [IBM Tivoli Federated Identity Manager (TFIM)] (www.ibm.com/software/products/en/federated-identity-mgr) using OpenID 2.0.

This module lets you authenticate using TFIM in your Node.js applications. By plugging into Passport, TFIM authentication can be integrated into any application or framework that supports or impements Express.

Installing

$ npm install --save passport-ibm

How to use this module

Configuring the strategy

The IBM authentication strategy authenticates users who have an IBM ID which is also their OpenID 2.0 identifier. The strategy requires the developer to implement a callback, which accepts the IBM ID (identifier), calls 'done' and injects a 'user' object. Options can also be supplied to specify a return URL, a realm and profile exchange which defaults to true.

passport.use('ibm', new IBMStrategy({

       returnURL: 'http://localhost.ibmserviceengage.com:3005/auth/ibm/return',
       realm: 'http://localhost.ibmserviceengage.com:3005/'
    },

    //Callback
    function(identifier, profile, done) {
        // asynchronous check
        process.nextTick(function () 
        {
          console.log("*** Identifier *** "+identifier);
          console.log("*** Email ***"+profile.emails[0].value);
          return done(null, { identifier: profile});
        });
    }

Authenticate Requests

Use passport.authenticate() and specify the 'ibm' strategy, to authenticate requests.

Here is an example for route middleware in an Express application:

app.get('/auth', passport.authenticate('ibm'),function (req, res) 
{
    res.status(200).end();
});

// This is the return URL called by Passport
app.get('/auth/ibm/return', 
  passport.authenticate('ibm', { failureRedirect: '/loginpage' }),
  function(req, res) {
    // Success ... redirect to main page.
    res.redirect('/');
  });

Contact

License

(C) Copyright IBM Corp. 2015 All Rights Reserved

passport-ibm's People

Contributors

sachbalag avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.