No commit activity in last 3 years
No release in over 3 years
NoBrainer mixin for SimpleOAuth2 authorization
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

NoBrainer SimpleOAuth2

Build Status Dependency Status Coverage Status Code Climate security License

NoBrainer mixin for simple_oauth2. Includes all the required API, associations, validations and callbacks.

Installation

Add this line to your application's Gemfile:

gem 'nobrainer_simple_oauth2'

And then execute:

$ bundle

Or install it yourself as:

$ gem install nobrainer_simple_oauth2

Usage

OAuth2 workflow implies the existence of the next four roles: Access Token, Access Grant, Application and Resource Owner. The gem needs to know what classes work, so you need to create them, and also you need to configure Simple::OAuth2.

Your project must include 4 models - AccessToken, AccessGrant, Client and User for example. These models must contain a specific set of API (methods). So everything that you need, it just include each mixin to specific class.

AccessToken class:

  # app/models/access_token.rb

  class AccessToken
    include NoBrainer::Simple::OAuth2::AccessToken
  end

AccessGrant class:

  # app/models/access_grant.rb

  class AccessGrant
    include NoBrainer::Simple::OAuth2::AccessGrant
  end

Client class:

  # app/models/client.rb

  class Client
    include NoBrainer::Simple::OAuth2::Client
  end

User class:

  # app/models/user.rb

  class User
    include NoBrainer::Simple::OAuth2::ResourceOwner
  end

And that's it. Also you can take a look at the mixins to understand what they are doing and what they are returning.

Bugs and Feedback

Bug reports and feedback are welcome on GitHub at https://github.com/simple-oauth2/nobrainer_simple_oauth2/issues.

Contributing

  1. Fork the project.
  2. Create your feature branch (git checkout -b my-new-feature).
  3. Implement your feature or bug fix.
  4. Add documentation for your feature or bug fix.
  5. Add tests for your feature or bug fix.
  6. Run rake and rubocop to make sure all tests pass.
  7. Commit your changes (git commit -am 'Add new feature').
  8. Push to the branch (git push origin my-new-feature).
  9. Create new pull request.

Thanks.

License

The gem is available as open source under the terms of the MIT License.

Copyright (c) 2016-2017 Volodimir Partytskyi (volodimir.partytskyi@gmail.com).