Sha256: 93d6f52eb0a2e08363f3050de5a3ae447dabf9f13531769f120cb8bec605f21b

Contents?: true

Size: 682 Bytes

Versions: 9

Compression:

Stored size: 682 Bytes

Contents

require 'omniauth/core'

module OmniAuth
  class Builder < ::Rack::Builder 
    def initialize(app, &block)
      @app = app
      super(&block)
    end
    
    def on_failure(&block)
      OmniAuth.config.on_failure = block
    end
    
    def configure(&block)
      OmniAuth.configure(&block)
    end
    
    def provider(klass, *args, &block)
      if klass.is_a?(Class)
        middleware = klass
      else
        middleware = OmniAuth::Strategies.const_get("#{OmniAuth::Utils.camelize(klass.to_s)}")
      end
      
      use middleware, *args, &block
    end
    
    def call(env)
      @ins << @app unless @ins.include?(@app)
      to_app.call(env)
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
oa-core-0.2.4 lib/omniauth/builder.rb
oa-core-0.2.3 lib/omniauth/builder.rb
oa-core-0.2.2 lib/omniauth/builder.rb
oa-core-0.2.1 lib/omniauth/builder.rb
oa-core-0.2.0 lib/omniauth/builder.rb
oa-core-0.2.0.beta5 lib/omniauth/builder.rb
oa-core-0.2.0.beta4 lib/omniauth/builder.rb
oa-core-0.2.0.beta3 lib/omniauth/builder.rb
oa-core-0.2.0.beta2 lib/omniauth/builder.rb