HubIdentityRuby
A Rails Engine designed to make implementing HubIdentity authentication easy and fast. In order to use this package you need to have an account with HubIdentity
Currently this is only for Hivelocity uses. If you have a commercial interest please contact the Package Manager Erin Boeger through linkedIn or Github or through Hivelocity.
Installation
Add this line to your application's Gemfile:
gem 'hub_identity_ruby'
And then execute:
$ bundle
Or install it yourself as:
$ gem install hub_identity_ruby
inside your ApplicationController:
include HubIdentityRuby::ControllerHelpers
inside your routes.rb mount the HubIdentity routes.
mount HubIdentityRuby::Engine => "/hub_identity_ruby"
This will add the following routes to your application:
- sessions_new GET /sessions/new(.:format) hub_identity_ruby/sessions#new
- sessions_create GET /sessions/create(.:format) hub_identity_ruby/sessions#create
- sessions_destroy DELETE /sessions/destroy(.:format) hub_identity_ruby/sessions#destroy
Environmental Variables
set your public and private keys and HubIdentity url
HUBIDENTITY_PRIVATE_KEY="a private key from HubIdentity website"
HUBIDENTITY_PUBLIC_KEY="a public key from HubIdentity website"
HUBIDENTITY_URL="for production deployment defaults to staging server"
Currently the HUBIDENTITY_URL defaults to staging HubIdentity server.
Restricted routes
For authentication required (restricted) routes add the before_action
helpers.
for example:
before_action :authenticate_user!, only: [:page_1, :page_2]
before_action :set_current_user
use the before_action :authenticate_user!
to restrict routes and require a user to authenticate.
use the before_action :set_current_user
helper to have an @current_user
in your views to help with navigation.
License
The gem is available as open source under the terms of the MIT License.