Sha256: f829b9b6cabd44ef7b3a2ff1385b3347c7cfc2ba63470a2b82831b6d472ab2c8

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

require 'rails'
require 'omniauth/oauth'
require 'muck-auth'

module MuckAuth
  class Engine < ::Rails::Engine
    
    def muck_name
      'muck-auth'
    end
    
    initializer 'muck_auth.helpers' do |app|
      ActiveSupport.on_load(:action_view) do
        include MuckAuthHelper
      end
    end
    
    initializer 'muck_auth.i18n' do |app|
      ActiveSupport.on_load(:i18n) do
        I18n.load_path += Dir[ File.join(File.dirname(__FILE__), '..', '..', 'config', 'locales', '*.{rb,yml}') ]
      end
    end

    initializer "muck_auth.add_middleware" do |app|
      raise MuckAuth::Exceptions::InvalidConfiguration, "Please provide a valid configuration for Muck Auth." if Secrets.auth_credentials.blank?
      
      Secrets.auth_credentials.each_key do |provider|
        Rails.application.config.middleware.use OmniAuth::Builder do
          provider(provider, Secrets.auth_credentials[provider]['key'], Secrets.auth_credentials[provider]['secret'], :scope => Secrets.auth_credentials[provider]['scope'])
        end  
      end      
    end
       
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
muck-auth-3.5.4 lib/muck-auth/engine.rb
muck-auth-3.5.3 lib/muck-auth/engine.rb
muck-auth-3.5.2 lib/muck-auth/engine.rb
muck-auth-3.5.1 lib/muck-auth/engine.rb