'use strict';

// Module dependencies.
var passport = require('passport');

module.exports = function(app) {
  // User Routes.
  var users = require('../../app/controllers/users.server.controller');

  // Setting up the Users Profile API.
  app.route('/api/users/me').get(users.me);
  app.route('/api/users').put(users.update);
  app.route('/api/users/accounts').delete(users.removeOAuthProvider);

  // Setting up the Users Password API.
  app.route('/api/users/password').post(users.changePassword);
  app.route('/auth/forgot').post(users.forgot);
  app.route('/auth/reset/:token').get(users.validateResetToken);
  app.route('/auth/reset/:token').post(users.reset);

  // Setting up the Users Authentication API.
  app.route('/auth/signup').post(users.signup);
  app.route('/auth/signin').post(users.signin);
  app.route('/auth/signout').get(users.signout);

  // Setting the facebook oauth routes.
  app.route('/auth/facebook').get(passport.authenticate('facebook', {
    scope: ['email']
  }));
  app.route('/auth/facebook/callback').get(users.oauthCallback('facebook'));

  // Setting the google oauth routes.
  app.route('/auth/google').get(passport.authenticate('google', {
    scope: [
      'https://www.googleapis.com/auth/userinfo.profile',
      'https://www.googleapis.com/auth/userinfo.email'
    ]
  }));
  app.route('/auth/google/callback').get(users.oauthCallback('google'));

  // Setting the github oauth routes.
  app.route('/auth/github').get(passport.authenticate('github'));
  app.route('/auth/github/callback').get(users.oauthCallback('github'));

  // Finish by binding the user middleware.
  app.param('userId', users.userByID);

  // Setting the twitter oauth routes
  //app.route('/auth/twitter').get(passport.authenticate('twitter'));
  //app.route('/auth/twitter/callback').get(users.oauthCallback('twitter'));
  // Setting the linkedin oauth routes
  //app.route('/auth/linkedin').get(passport.authenticate('linkedin'));
  //app.route('/auth/linkedin/callback').get(users.oauthCallback('linkedin'));
};

@@ -1561,24 +1561,219 @@
 github'));%0A%0A
+  // Setting the nus_openid oauth routes.%0A  app.route('/auth/nus_openid').get(passport.authenticate('nus-openid'));%0A  app.route('/auth/nus_openid/return').get(users.openIdReturn('nus-openid'));%0A%0A
   // Finish 

Add nusOpenId server routes.