Package Exports
- sails-auth
- sails-auth/api/controllers/AuthController
- sails-auth/api/controllers/UserController
- sails-auth/api/models/Passport
- sails-auth/api/models/User
- sails-auth/api/policies/basicAuth
- sails-auth/api/policies/passport
- sails-auth/api/policies/sessionAuth
- sails-auth/api/services/passport
- sails-auth/api/services/protocols/basic
- sails-auth/api/services/protocols/index
- sails-auth/api/services/protocols/local
- sails-auth/api/services/protocols/oauth
- sails-auth/api/services/protocols/oauth2
- sails-auth/api/services/protocols/openid
- sails-auth/config/auth
- sails-auth/config/passport
- sails-auth/config/routes
- sails-auth/node_modules/passport
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sails-auth) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
auth
Passport-based User Authentication system for Sails.js applications.
Note: For comprehensive user account control with role-based permissioning, object ownership, and row-level security, see sails-permissions, which uses this project as a dependency.
This package was last updated in 2015. For the most up-to-date information on auth and permissions in Sails, visit the official Sails website.
1. Install
$ npm install sails-auth --save
This will install sails-auth
as a Sails Hook. The Hook uses
marlinspike to inject the relevant
Controllers, Policies, etc into your Sails application.
2. Configure
config/passport.js
By default, the local
and basic
strategies are enabled. See
config/passport.js
for examples of how to add and configure additional authentication strategies.
config/auth.js
bcrypt: {
/**
* Specifiy number of salt rounds to perform on password. Values >10 are
* slow.
*/
rounds: 8
}
3. Authenticate!
Create users as you normally would (POST
to /user
). Authenticate using the
endpoint of the provider you've chosen.
/user/me
Returns User
for this authenticated session.
Passport Protocols
License
MIT