Module: Saml::Rails::ControllerHelper

Defined in:
lib/saml/rails/controller_helper.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
# File 'lib/saml/rails/controller_helper.rb', line 4

def self.included(base)
  base.extend self
  base.before_filter :set_response_headers
end

Instance Method Details

#current_provider(entity_id_or_method = nil, &block) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/saml/rails/controller_helper.rb', line 9

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

#current_store(store) ⇒ Object



22
23
24
# File 'lib/saml/rails/controller_helper.rb', line 22

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

#set_response_headersObject



26
27
28
29
# File 'lib/saml/rails/controller_helper.rb', line 26

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