Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rula/passport-cas

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rula/passport-cas

A Passport authentication strategy that works with the Central Authentication Service (CAS) single sign-on protocol.

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

passport-cas

Passport authentication strategy using a Central Authentication Strategy (CAS) server. Supports CAS protocol versions 1.0, 2.0 and 3.0.

npm install @rula/passport-cas

Configure Strategy

Minimum configuration requires the CAS url and service parameters to be defined.

passport.use(new (require('passport-cas').Strategy) ({
  casUrl: 'http://cas.example.com',
  serviveUrl: `http://localhost:3000'
}, function(req, user, done) {
  User.findOne({username: user.username}, function(err, user) {
    if (err) {
      return done(err);
    }
    if (!user) {
      return done(null, false, {message: "Unknown user'});
    }
    return done(null, user);
  });
}));

Authenticate Requests

Using the Express Passport middleware as an example:

exports.casLogin = function(req, res, next) {
  passport.authenticate('cas', function (err, user, info) {
    if (err) {
      return next(err);
    }

    if (!user) {
      req.session.messages = info.message;
      return res.redirect('/');
    }

    req.logIn(user, function (err) {
      if (err) {
        return next(err);
      }

      req.session.messages = '';
      return res.redirect('/');
    });
  })(req, res, next);
};

Keywords

FAQs

Package last updated on 19 Jul 2018

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc