{"repo":"fnando/simple_auth","free":true,"listed":false,"github":"https://github.com/fnando/simple_auth","clone":"git clone https://github.com/fnando/simple_auth.git","description":"SimpleAuth is an authentication library to be used when everything else is just too complicated.","language":"Ruby","stars":17,"topics":["rails","authentication"],"license":"MIT","category":"auth-billing-email","readme_excerpt":"Simple Auth SimpleAuth is an authentication library to be used when everything else is just too complicated. This library only handles session. You have to implement the authentication strategy as you want (e.g. in-site authentication, OAuth, etc). Installation Just the following line to your Gemfile: gem \"simple auth\" Then run rails generate simple auth:install to copy the initializer file. Usage The initializer will install the required helper methods on your controller. So, let's say you want to support user and admin authentication. You'll need to specify the following scope. Session is valid only when Controller#authorized #{scope}? method returns true , which is the default behavior. You can override these methods with your own rules; the following example shows how you can authorize all e-mails from @example.com to access the admin dashboard. So, how do you set up a new user session? That's really simple, actually. First thing to notice is that SimpleAuth doesn't care about how you authenticate. You could easily set up a different authentication strategy, e.g. API tokens. The important part is assigning the record: and scope: options. The return to helper will give you the requested url (before the user logged in) or the default url. SimpleAuth uses GlobalID as the session identifier. This allows using any objects that respond to #to gid , including namespaced models and POROs. If you need to locate a record using such value, you can do it by calling GlobalID::Locator.","default_branch":null,"files":null,"tree":[],"storefront":"/r/fnando","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/fnando/simple_auth/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}