Sha256: 2e71d1416cc6c2a6cfc957c0d9115a6cdbf9bbe05c6afb5dd69cf12d4d063c3b

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

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

1 entries across 1 versions & 1 rubygems

Version Path
sso_clyent-0.0.7.33 lib/sso_clyent/engine.rb