Skip to content

Passport-based User Authentication system for sails.js applications. Designed to work well with the sails-permissions module.

License

Notifications You must be signed in to change notification settings

dominicrico/sails-auth

 
 

Repository files navigation

sails-auth

Sails-Auth ready for Sails.js v1.0

This repo is forked from langateam/sails-auth

NPM version Dependency Status

Passport-based User Authentication system for Sails.js applications.

1. Install

$ npm install sails-auth-new --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/custom.js

By default, the local and basic strategies are enabled. See config/custom.js for examples of how to add and configure additional authentication strategies.

Also set the bcrypt config for salt rounds here and the appUrl.

  appUrl: 'localhost:1337', //for development
  bcrypt: {
    /**
     * Specifiy number of salt rounds to perform on password. Values >10 are
     * slow.
     */
    rounds: 8
  },
  passport: {
    /**
     * Strategies go here
     */
  }

3. Authenticate!

Create users as you normally would (POST to /user). Authenticate using the endpoint of the provider you've chosen.

Local

Authenticate with the local strategy via a POST to /auth/local with params identifier (email) and password). This will also create a session. See passport.local for more.

HTTP Basic and Digest

See passport.http.

Additional Passport Strategies

/user/me

Returns User for this authenticated session.

Permissions

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.

License

MIT

Original Fork is Maintained By

About

Passport-based User Authentication system for sails.js applications. Designed to work well with the sails-permissions module.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%