Sha256: 3b2e829a0d9b40537cf6b6e12f41b84ba04bcbf502af043f687c24c788e8399d

Contents?: true

Size: 865 Bytes

Versions: 30

Compression:

Stored size: 865 Bytes

Contents

module Saml
  module Rails
    module ControllerHelper
      def self.included(base)
        base.extend self
        base.before_action :set_response_headers
      end

      def current_provider(entity_id_or_method = nil, &block)
        if block_given?
          before_action &block
        else
          case entity_id_or_method
            when Symbol
              before_action { Saml.current_provider = send(entity_id_or_method) }
            else
              before_action { Saml.current_provider = Saml.provider("#{entity_id_or_method}") }
          end
        end
      end

      def current_store(store)
        before_action { Saml.current_store = store }
      end

      def set_response_headers
        response.headers['Cache-Control'] = 'no-cache, no-store'
        response.headers['Pragma']        = 'no-cache'
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
libsaml-3.13.1 lib/saml/rails/controller_helper.rb
libsaml-3.13.0 lib/saml/rails/controller_helper.rb
libsaml-3.12.0 lib/saml/rails/controller_helper.rb
libsaml-3.11.0 lib/saml/rails/controller_helper.rb
libsaml-3.10.0 lib/saml/rails/controller_helper.rb
libsaml-3.9.3 lib/saml/rails/controller_helper.rb
libsaml-3.9.2 lib/saml/rails/controller_helper.rb
libsaml-3.9.1 lib/saml/rails/controller_helper.rb
libsaml-3.9.0 lib/saml/rails/controller_helper.rb
libsaml-3.8.0 lib/saml/rails/controller_helper.rb
libsaml-3.7.0 lib/saml/rails/controller_helper.rb
libsaml-3.6.0 lib/saml/rails/controller_helper.rb
libsaml-3.5.0 lib/saml/rails/controller_helper.rb
libsaml-3.4.0 lib/saml/rails/controller_helper.rb
libsaml-3.3.0 lib/saml/rails/controller_helper.rb
libsaml-3.2.3 lib/saml/rails/controller_helper.rb
libsaml-3.2.2 lib/saml/rails/controller_helper.rb
libsaml-3.2.1 lib/saml/rails/controller_helper.rb
libsaml-3.1.2 lib/saml/rails/controller_helper.rb
libsaml-3.1.1 lib/saml/rails/controller_helper.rb