Self Auth Rails Engine

CI

self-auth-rails is rails engine to easily integrate Self Authentication on your authentication workflow.

Usage

How to use my plugin.

Getting started

Installation

Add this line to your application's Gemfile:

gem "self-auth-rails"

And then execute:

$ 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.