示例#1
0
module.exports = function password(options) {
	return async.series(
		grants('password', true),
		required(['username', 'password']),
		function (req, res, next) {
			lookup({
				username: req.body.username,
				password: req.body.password
			}, function(err, user) {
				if (err) {
					return next(err)
				} else if (!result) {
					return next({ });
				} else {

				}
			});
		}
	);
};
module.exports = function clientCredentials(options) {

	return async.series(
		grants('client_credentials', true),
		function middleware(req, res, next) {
			lookup({
				clientId: req.body.client_id,
				clientSecret: req.body.client_secret
			}, function(err, result) {
				if (err) {
					return next(err);
				} else if (!result) {
					return next({ });
				} else {
					next();
				}
			});
		}
	);
};