Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/trailsjs/sails-auth
Passport-based User Authentication system for sails.js applications. Designed to work well with the sails-permissions module.
https://github.com/trailsjs/sails-auth
Last synced: about 2 months ago
JSON representation
Passport-based User Authentication system for sails.js applications. Designed to work well with the sails-permissions module.
- Host: GitHub
- URL: https://github.com/trailsjs/sails-auth
- Owner: trailsjs
- License: mit
- Created: 2014-09-12T07:17:30.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2018-12-25T14:47:37.000Z (over 5 years ago)
- Last Synced: 2024-07-28T18:09:07.884Z (about 2 months ago)
- Language: JavaScript
- Homepage: https://www.npmjs.org/package/sails-auth
- Size: 214 KB
- Stars: 265
- Watchers: 13
- Forks: 141
- Open Issues: 60
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sails-auth
[![Looking for maintainers][hacktober-image]][hacktober-url]
[![NPM version][npm-image]][npm-url]
[![Build status][travis-image]][travis-url]
[![Dependency Status][daviddm-image]][daviddm-url][Passport](http://passportjs.org/)-based User Authentication system for Sails.js applications.
## 1. Install
```sh
$ npm install sails-auth --save
```
This will install `sails-auth` as a Sails Hook. The Hook uses
[marlinspike](https://github.com/tjwebb/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](https://github.com/langateam/sails-auth/blob/master/config/passport.js)
for examples of how to add and configure additional authentication strategies.#### `config/auth.js`
```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.
#### 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](https://github.com/jaredhanson/passport-local) for more.#### HTTP Basic and Digest
See [passport.http](https://github.com/jaredhanson/passport-http).#### Additional Passport Strategies
- [passport.google](https://github.com/jaredhanson/passport-google-oauth)
- [passport.twitter](http://passportjs.org/guide/twitter/)
- [passport.github](https://github.com/jaredhanson/passport-github)
- [passport.facebook](http://passportjs.org/guide/facebook/)
- et al#### `/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**](https://github.com/langateam/sails-permissions), which uses this project as a dependency.## License
MIT## Maintained By
[](http://langa.io)
- [Travis Webb](https://github.com/tjwebb)
- [Ryan Quinn](https://github.com/ryanwilliamquinn)
- [Contributors](https://github.com/langateam/sails-auth/graphs/contributors)[npm-image]: https://img.shields.io/npm/v/sails-auth.svg?style=flat-square
[npm-url]: https://npmjs.org/package/sails-auth
[travis-image]: https://img.shields.io/travis/langateam/sails-auth.svg?style=flat-square
[travis-url]: https://travis-ci.org/langateam/sails-auth
[daviddm-image]: http://img.shields.io/david/langateam/sails-auth.svg?style=flat-square
[daviddm-url]: https://david-dm.org/langateam/sails-auth
[hacktober-image]: http://i.imgur.com/FM9yVCI.png
[hacktober-url]: https://twitter.com/langateam/status/782995392212369408