Skip to content

praece/sails-auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Praece Sails Auth

Token based auth for praece sails applications. Plug and play support for auth0 tokens and automatically disables all destroy endpoints by default.

Configuration:

module.exports.auth = {
	secret: 'secret!',
	audience: 'audience',

	/**
	 * Optional - a function that returns a promise that resolves to the proper user given the
	 * supplied email param. If this function is omitted it will just search the User model for
	 * using the email attribute.
	 */
	findUser: function(email) {
		return Email.findOne({email: email})
			.populate('user')
			.then().get('user');
	}
}

Policies:

module.exports.policies = {
	'*': 'token',
	controller: {
		superSecret: ['token', 'administrator']
	}
}

About

Drop in auth0 jwt auth for sails js

Resources

Stars

Watchers

Forks

Packages

No packages published