JSPM

  • Created
  • Published
  • Downloads 29
  • Score
    100M100P100Q62125F
  • License MIT

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

Package Exports

  • sails-auth
  • sails-auth/api/controllers/AuthController
  • sails-auth/api/controllers/UserController
  • sails-auth/api/hooks/sails-auth
  • 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/passport
  • sails-auth/config/routes/sails-auth
  • 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

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.

Install

$ npm install sails-auth --save

Usage

1. configure .sailsrc

{
  "generators": {
    "modules": {
      "auth-api": "sails-auth"
    }
  }
}

2. install sails.js extension

$ sails generate auth-api

config/policies.js

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

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

The policies above secure everything by default, including registration. In case you wish to open it, 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