Sha256: 471e57116a2cfdd4fe7c6883372c8e81243d70d06857b9cb22e2a31ff1e4bf1f

Contents?: true

Size: 1.32 KB

Versions: 7

Compression:

Stored size: 1.32 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
        helper SsoClyent::PathHelpers
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sso_clyent-0.1.3 lib/sso_clyent/engine.rb
sso_clyent-0.1.2 lib/sso_clyent/engine.rb
sso_clyent-0.1.1 lib/sso_clyent/engine.rb
sso_clyent-0.1.0 lib/sso_clyent/engine.rb
sso_clyent-0.0.7.38 lib/sso_clyent/engine.rb
sso_clyent-0.0.7.37 lib/sso_clyent/engine.rb
sso_clyent-0.0.7.36 lib/sso_clyent/engine.rb