README.md in auth0_current_user-0.1.0.4 vs README.md in auth0_current_user-0.1.0.5

- old
+ new

@@ -1,11 +1,8 @@ # Auth0CurrentUser +[![Gem Version](https://badge.fury.io/rb/auth0_current_user.svg)](https://badge.fury.io/rb/auth0_current_user) -Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/auth0_current_user`. To experiment with that code, run `bin/console` for an interactive prompt. - -TODO: Delete this and the text above, and describe your gem - ## Installation Add this line to your application's Gemfile: ```ruby @@ -20,10 +17,23 @@ $ gem install auth0_current_user ## Usage -TODO: Write usage instructions here +After including the gem in your Gemfile, run `rails g auth0_current_user:install` to install the initializer. This configuration of the gem is dependant on a couple of attributes: + * `auth0_domain` + * This is the domain from setting up your Auth0 application. + * `auth0_audience` + * This is the api identifier that you chose when creating your api(M2M) application + * `authenticated_klass` + * Defaults to `User`, but if you have a different model name for the class that will be logging in and being authenticate, be sure to change that in the initializeer. + * accepted values are symbols or strings + * :user, 'user', :User, 'User' + * :my_user, 'my_user', :MyUser, 'MyUser' + +To take advantage of the Auth0 authenticating add `include Auth0CurrentUser::Secured` to your base controller or and controller that you wish to be locked down for authentication. + +Once the `Secured` module is included in your controller, that will give you access to the `#current_user` method. It will find the `authenticated_klass` by it's email and using [Request Store](https://github.com/steveklabnik/request_store), store the user to be available either globally throught the store or in the controllers and views with the `#current_user` method. ## Development After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.