Module: Gatekeeper::Helpers::Rack

Defined in:
lib/gatekeeper/helpers/rack.rb

Instance Method Summary collapse

Instance Method Details

#absolute_url(suffix = nil) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/gatekeeper/helpers/rack.rb', line 26

def absolute_url(suffix = nil)
  port_part = case request.scheme
              when "http"
                request.port == 80 ? "" : ":#{request.port}"
              when "https"
                request.port == 443 ? "" : ":#{request.port}"
              end
  "#{request.scheme}://#{request.host}#{port_part}#{suffix}"
end

#excluded_path?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/gatekeeper/helpers/rack.rb', line 36

def excluded_path?
  options.exclude_paths && options.exclude_paths.include?(request.path_info)
end

#sso_logged_in?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/gatekeeper/helpers/rack.rb', line 4

def sso_logged_in?
  session[:sso] && sso_user_id
end

#sso_login_as(user_id, sreg_params) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/gatekeeper/helpers/rack.rb', line 8

def (user_id, sreg_params)
  session.delete(:last_oidreq)
  session.delete('OpenID::Consumer::last_requested_endpoint')
  session.delete('OpenID::Consumer::DiscoveredServices::OpenID::Consumer::')

  session[:sso] ||= { }
  session[:sso][:user_id] = user_id
  sreg_params.each { |key, value| session[:sso][key.to_sym] = value.to_s }
end

#sso_user_emailObject



22
23
24
# File 'lib/gatekeeper/helpers/rack.rb', line 22

def sso_user_email
  session[:sso][:email]
end

#sso_user_idObject



18
19
20
# File 'lib/gatekeeper/helpers/rack.rb', line 18

def sso_user_id
  session[:sso][:user_id]
end