Sha256: d206c288049919cecd0bbe476f7b484afdb98d223ec8383280950bce91962fc8

Contents?: true

Size: 1.88 KB

Versions: 4

Compression:

Stored size: 1.88 KB

Contents

# self-auth-rails

self-auth-rails is rails engine to easily integrate [Self Authentication](https://docs.joinself.com/authentication/) on your authentication workflow.

## Usage
How to use my plugin.

## Getting started
### Installation
Add this line to your application's Gemfile:

```ruby
gem "self-auth-rails"
```

And then execute:
```bash
$ bundle install
```

### Set up

For your convenience `self-auth-rails` comes with a script to automatically set up the initializers and mounting routes on your system.

```
$ rake self_auth_rails:init
```

This command will
- [x] Generate necessary migrations
- [x] Create initializers (config/initializers/self_auth_rails.rb)
- [x] Mount the engine on your routes (config/routes.rb)

Once that's done you'll need to: 

- [ ] run the created migrations with `bin/rails db:migrate` 
- [ ] setup the environment variables required on `config/initializers/self_auth_rails.rb`
- [ ] protect the resources you want to hide from the public

### Protecting routes

You can fully protect your app by adding a controller filter to your `app/controllers/application.rb`, or specifying it only for the routes you want to be protected.
```
class ApplicationController < ActionController::Base
    before_action :authenticate_user!
end
```

### Running it

That's it, as soon as you have the SELF required environment variables in place, you'll be able to see the authentication screen when you visit http://localhost:3000.


### Notes
#### Action cable
By default action cable relies on redis to work on development, if you're just testing this gem, you can switch it to `async` on `config/cable.yml`
```
development:
  adapter: async

#...
```

## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/joinself/self-auth-rails.

## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
self-auth-rails-0.1.4 README.md
self-auth-rails-0.1.3 README.md
self-auth-rails-0.1.2 README.md
self-auth-rails-0.1.1 README.md