salttis / sails-auth

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

Home Page:https://www.npmjs.org/package/sails-auth

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

auth

NPM version Build status Dependency Status

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.

1. Install

$ npm install sails-auth --save

This will install sails-auth has a Sails.js Hook. The Hook uses marlinspike to extend the relevant Models, Controllers, etc.

2. Setup Policies

config/policies.js

  '*': [ 'basicAuth', 'passport', 'sessionAuth' ],

  AuthController: {
    '*': [ 'passport' ]
  }

The policies above secure everything by default, including registration. If you'd like to open registration to all users, add the following:

  UserController: {
    'create': true
  }

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

Maintained By

About

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

https://www.npmjs.org/package/sails-auth

License:MIT License


Languages

Language:JavaScript 100.0%