Sha256: 6b18afc8eea0e185a777e03f35d46346d4b0f19579636a519ae6ee4d776835e8

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 KB

Contents

require_relative './controllers/current_user_helpers'
require_relative './controllers/path_helpers'

module SsoClyent
  class Engine < ::Rails::Engine
    isolate_namespace SsoClyent

    config.generators do |g|
          g.test_framework :rspec, :view_specs => false
    end

    config.sso_clyent = ActiveSupport::OrderedOptions.new

    initializer "sso_client.configure" do |app|     
      should_load_sso_clyent = app.config.sso_clyent.try(:keys).try(:include?, :setup_omniauth) ? app.config.sso_clyent[:setup_omniauth] : true
      if should_load_sso_clyent
        SsoClyent.configure(app.config.sso_clyent)
        
        require 'sso_clyent/omniauth/strategies/sso'

        app.config.middleware.use OmniAuth::Builder do
          provider :sso, SsoClyent.provyder[:app_id], SsoClyent.provyder[:app_secret],
            { :callback_path => "#{SsoClyent.path}/auth/sso/callback",
              :path_prefix => "#{SsoClyent.path}/auth"
            }.merge(SsoClyent.ssl_config || {})
        end
      end
    end
    
    initializer 'sso_clyent.extend_controllers_and_view_helpers' do |app|
      ActiveSupport.on_load :action_controller do
        include SsoClyent::CurrentUserHelpers
        include SsoClyent::PathHelpers
        helper SsoClyent::CurrentUserHelpers
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sso_clyent-0.0.7.35 lib/sso_clyent/engine.rb
sso_clyent-0.0.7.34 lib/sso_clyent/engine.rb