Sha256: bd4244c766f452e115acb5baa8be3f37b2bc8ed855eef182d4cee45104d1d4e2
Contents?: true
Size: 997 Bytes
Versions: 2
Compression:
Stored size: 997 Bytes
Contents
require 'omniauth' module OmniAuth class Builder < ::Rack::Builder def initialize(app, &block) if rack14? super else @app = app super(&block) end end def rack14? Rack.release.split('.')[1].to_i >= 4 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 begin middleware = OmniAuth::Strategies.const_get("#{OmniAuth::Utils.camelize(klass.to_s)}") rescue NameError raise LoadError, "Could not find matching strategy for #{klass.inspect}. You may need to install an additional gem (such as omniauth-#{klass})." end end use middleware, *args, &block end def call(env) @ins << @app unless rack14? || @ins.include?(@app) to_app.call(env) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
omniauth-1.0.3 | lib/omniauth/builder.rb |
omniauth-1.0.2 | lib/omniauth/builder.rb |