0.0.3 • Published 9 years ago
sails-aaf-rapid-connect v0.0.3
Sails AAF Rapid Connect
If you're using Sails.js, an even more rapid way of authenticating with AAF :)
Installation
Install the module in your Sails app:
$ npm install sails-aaf-rapid-connect --saveCreate a service named 'userLoginService' with the following methods:
module.exports = {
  /**
  * payload - Object, AAF attributes, see RapidAAF documentation
  * req - Sails.js request object
  * res - Sails.js response object
  */
  validUser: function(payload, req, res) {
    // called when user is valid, you can do whatever you want, etc.
    // return res.redirect(url);
  },
  /**
  * reason - string 
  * req - Sails.js request object
  * res - Sails.js response object
  */
  invalidUser: function(reason, req, res) {
    sails.log.error("User failed to login: " + reason);
    return res.json({failureReason: reason});
  }
};Add the following configuration:
auth: {
  jwsSecret:'<The Secret used when registering the AAF Service>', 
  algo: 'HS256',
  aaf: {
    login_url:'<The Unique URL AAF provided after registering>' 
  }
}