kasperisager/sails-generate-auth

View on GitHub
templates/api/services/protocols/cas.js

Summary

Maintainability
A
0 mins
Test Coverage
/**
 * Central Authentication Service (CAS) Authentication Protocol
 *
 * CAS is a single sign-on protocol meant to give a user access to
 * more than one application by only submitting their credentials once.
 *
 * @param {Object}   req
 * @param {string}   identifier
 * @param {Function} next
 */
module.exports = function (req, identifier, next) {
  var query    = {
    identifier : identifier
  , protocol   : 'cas'
  };

  passport.connect(req, query, {username: identifier}, next);
};