Module: Centro::SsoWhat::BaseDomainSession

Defined in:
lib/thumblemonks/base_domain_session.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



4
5
6
# File 'lib/thumblemonks/base_domain_session.rb', line 4

def self.included(klass)
  klass.alias_method_chain :call, :domain_override
end

Instance Method Details

#call_with_domain_override(env) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/thumblemonks/base_domain_session.rb', line 8

def call_with_domain_override(env)
  if @default_options[:base_domain]
    base_host = env["HTTP_HOST"].scan(/[0-9a-z-]+\.[0-9a-z-]+(?=:|$)/i).first
    @default_options[:domain] = base_host ? ".#{base_host}" : base_host
  end
  call_without_domain_override(env)
end