Sha256: 25d84827f8085d9472f3017044a06662efcf1a4664de5ea88914b0e1eadeca4b
Contents?: true
Size: 1.16 KB
Versions: 3
Compression:
Stored size: 1.16 KB
Contents
require "prx_auth/rails/version" require "prx_auth/rails/configuration" require "prx_auth/rails/railtie" if defined?(Rails) require "prx_auth/rails/engine" if defined?(Rails) module PrxAuth module Rails class << self attr_accessor :configuration, :installed_middleware def configure yield configuration if block_given? # only install from first call to configure block if configuration.install_middleware && !installed_middleware install_middleware! self.installed_middleware = true end end def install_middleware!(app = nil) app ||= ::Rails.application if defined?(::Rails) return false unless app # guess protocol from host host = configuration.id_host path = configuration.cert_path protocol = if host.include?("localhost") || host.include?("127.0.0.1") "http" else "https" end app.middleware.insert_after Rack::Head, Rack::PrxAuth, cert_location: "#{protocol}://#{host}/#{path}", issuer: host end end self.configuration = Configuration.new end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
prx_auth-rails-4.3.0 | lib/prx_auth/rails.rb |
prx_auth-rails-4.2.1 | lib/prx_auth/rails.rb |
prx_auth-rails-4.2.0 | lib/prx_auth/rails.rb |