Module: Saml::Rails::ControllerHelper

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

Instance Method Summary collapse

Instance Method Details

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



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/saml/rails/controller_helper.rb', line 4

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

#current_store(store_or_symbol = nil) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/saml/rails/controller_helper.rb', line 17

def current_store(store_or_symbol = nil)
  case store_or_symbol
    when Symbol
      before_action { Saml.current_store = store_or_symbol }
    else
      before_action do
        Saml::Config.register_store klass.name.underscore, klass_or_symbol
        Saml.current_store = klass.name.underscore
      end
  end
end